Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev 时生成 sourcemap? #63

Open
zaaack opened this issue Apr 26, 2018 · 13 comments
Open

dev 时生成 sourcemap? #63

zaaack opened this issue Apr 26, 2018 · 13 comments
Labels
help wanted Extra attention is needed

Comments

@zaaack
Copy link

zaaack commented Apr 26, 2018

没有 sourcemap 调试 TS 生成的 异步代码太麻烦了。。

@qiu8310
Copy link
Owner

qiu8310 commented May 4, 2018

不支持呢,不太好做,webpack 生成的 sourceMap 只有一个文件,我用了一些黑科技把它拆分成了多个文件

@qiu8310 qiu8310 added the help wanted Extra attention is needed label May 4, 2018
@zaaack
Copy link
Author

zaaack commented May 4, 2018

@qiu8310 能不能fork一个ts-loader?

@qiu8310
Copy link
Owner

qiu8310 commented May 4, 2018

什么意思?是说不用 awesome-typescript-loader,而使用 ts-loader 吗?

如果是的话,新的 v2(下午刚发布) 已经是默认使用 ts-loader 了,并且可以自由通过 webpack.minapp.js 修改 loader 和 loader 的配置,详情查看 https://qiu8310.github.io/minapp/docs/doc-custom-webpack.html#minapp-v2-loader-loader

@zaaack
Copy link
Author

zaaack commented May 4, 2018

我的意思是fork一个 loader 也许实现拆封js文件和sourcemap就容易一些了。。

@zaaack
Copy link
Author

zaaack commented May 4, 2018

或者加一个loader

@qiu8310
Copy link
Owner

qiu8310 commented May 4, 2018

那样的话 webpack 就没什么用了,完全 loader 就行,这样还要在 loader 中处理压缩的问题(虽然 css 现在就是这样做的)

@qiu8310
Copy link
Owner

qiu8310 commented May 4, 2018

而且 js-loader 还要去解析里面的 require 图片或者 css 问题,还是会挺麻烦的

@zaaack
Copy link
Author

zaaack commented May 4, 2018

got,那这个 loader 只是用来提取 sourcemap 呢?

@qiu8310
Copy link
Owner

qiu8310 commented May 4, 2018

loader 执行的时候,还没有 sourcemap,是在 uglify 压缩的时候生成的,这样的话就得提前使用 uglify 生成 sourceMap,也会有上面说的问题,提前生成的 sourcMap 可能不准确。

不过我建议你可以修改 tsconfig.json 中生成代码的 es 版本,把它配置高一些,最后生成的代码就会和你的源代码基本一样(只会将 ts 的 types 清除),然后开启小程序自带的开发者工具来压缩 js

@zaaack
Copy link
Author

zaaack commented May 4, 2018

我说的是 tsloader 生成的 sourcemap.. 不过你说的应该也可行,只是看网上说这样做有坑。。

@qiu8310
Copy link
Owner

qiu8310 commented May 4, 2018

奥,不过还是等以后能找到一种更好的生成代码的方式的时候再生成 sourceMap 吧

我一直想改现在生成代码的方式,现在是给源代码加上了特殊的标签,在 webpack 压缩合并处理之后,再根据这些特殊标签把代码拆分 /捂脸

@zaaack
Copy link
Author

zaaack commented May 4, 2018

好吧...

@fjswhl
Copy link

fjswhl commented Nov 14, 2018

tsconfig到es6, minapp build --pretty,异步代码调试起来不麻烦

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants