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

Will npm modules ever be supported without resorting to externals compiler option? #75

Open
foobardevpro opened this issue Oct 1, 2019 · 1 comment

Comments

@foobardevpro
Copy link

I cannot use certain npm modules because they only support cjs, which I would be easily able to use with webpack. Even for modules made for web the process is still painful -- having to add the module to externals, copying the bundle, and manually modifiying the HTML to use it / or a cdn.

@theseanl
Copy link
Owner

theseanl commented Oct 2, 2019

If your npm module is written in a way that is compatible with Closure Compiler, then the answer is it could be. I haven't had much exprience on it yet, but there is --process_common_js_modules flag that is used by closure compiler webpack plugin to transform commonjs modules to a form that closure can understand, so we may utilize it.

If not - I don't see any overlap of it with the scope of tscc. You can still use browserify or webpack to first transform commonjs modules into a web-compatible format and then append to html as a script tag.

Just speculating, maybe part of the functionality of TSCC can be built as a plugin to webpack and it will resolve your use case. Among sources provided to rollup or webpack, it may be possible to compile things specified in the spec file with tsickle + closure compiler, and somehow wire it up with the rest of them. I'd welcome If someone has more idea on implementing this.

+) closure webpack plugin had a feature request like this webpack-contrib/closure-webpack-plugin#26

@foobardevpro foobardevpro changed the title Will commonjs modules ever be supported without resorting to externals compiler option? Will npm modules ever be supported without resorting to externals compiler option? Oct 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants