sheerun / targets-webpack-plugin

Webpack plugin for transcompilig final bundles so they support legacy browsers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plugin breaks sourcemaps on Google Chrome

sprguillen opened this issue · comments

As stated in the README: This plugin runs babel and rollup only once per asset, at the end of the compilation process.

Works like a charm as it runs my VueJS app on IE but the problem is that it breaks sourcemaps on Chrome: here's a more elaborate article on stackoverflow.

Maybe you can address this if you have plans to update the module. Thanks!

Maybe you want to prepare and test the fix? I forked from other project where PR fixing this is available: https://github.com/simlrh/babel-webpack-plugin/pull/2/files

You mean I'll use babel-webpack-plugin in-conjunction with targets-webpack-plugin?

I mean to submit PR to this repository fixing this issue. You can find fix for repository I forked from in the link I've sent before

The issue is not with PR but with testing if it really works and that could be your part

I made some revisions to no avail. The PR isn't as simple as we thought it might because it requires us to use SourceMapSource instead of OriginalSource which need us to have an inputSourceMap defined. Adding the line where asset.sourceAndMap will be defined would lead to a Javascript heap out of memory error. I don't know if I'm doing it right since I did not author this module..

Reference to the changes I've applied are on this link.

@sprguillen I've published 2.0.0-alpha.0 which should have sourcemaps support. Do you want to test it?

Great! Thanks, I'll gladly test it for you.

2018-11-15_1314

I got this error, it's quite similar after I tried to applied the fix you mentioned..

Sorry my fault on webpack-source. I wasnt using 2.0 alpha but the Javascript heap out of memory is now happening on 2.0.0 alpha...

Did you try 2.0.0-alpha.1 ?

Yes, that's the one causing the error..

I think it's simply because sourcemaps are generated and you don't have enough memory. You can pass { sourceMaps: false } to disable generating sourcemaps but in general you should disable it for development

Does it fail on CI as well?

I haven't tried on CI. We actually need sourcemaps more on development rather than in production. :) I think bundling for legacy browsers + sourcemaps overloads NodeJS.

FYI it works for me on my CI, and on my OSX but I have 16GB ram

What's your current setup? I'm currently using Windows, Node 10.9.0..

I actually have 16gb ram as well.. CI means continuous integration right? I'm currently not using any CI tools. Just yarn or npm.

I think it does make the difference, I don't use any CI tool and maybe that's why I have those heap issues. This plugin when sourceMap enabled may only be compatible with having been deployed by Travis.. Have you tried it without using Travis? Just running the node server using yarn or npm? Does it work?

We made some changes on the webpack configuration and tested on 2.0.0-alpha.1, it successfully worked! Good job! Closing this issue now..

Glad to hear :) Mind to tell what changes?

We used the webpack-bundle-analyzer and restructured how plugins are being loaded by webpack, that may have reduced the amount of memory webpack is consuming when compiling code.