Closed LandonSchropp closed 8 years ago
So webpack is unable to notice there is a source-map file referenced from that file? That seems strange to me..
I could be missing something with Webpack, but that seems to be the case.
Webpack. Nothing unusual, simple config. Trying to use es6-promise in ProvidePlugin. It builds successfully, but after a while node crushes with this:
Error: ENOENT: no such file or directory, open './src/es6-promise.map'
I'm not quite sure why webpack is unable to locate the source map file.
//# sourceMappingURL=es6-promise.map
es6-promise.map
-> https://github.com/stefanpenner/es6-promise/blob/master/dist/es6-promise.mapThe browser, and other tools are able to correctly resolve this. I would assume WebPack can as-well.
@ericf do you have any ideas?
Just ran the following:
webpack --devtool source-map dist/es6-promise.js bundle.js
<script src="bundle.js"></script>
and source-maps appear to work correctly when viewed in the browser.
If --devtool source-map
is omitted, the output still contains the sourcemap URI, but in an invalid position resulting in the browser ignoring it.
So as a very barebones webpack config seems to "just work", I'm unsure if this is an issue with es6-promise or not. (I suspect not)
@ElForastero im also somewhat perplexed by your issue, as es6-promise
does not contain or reference src
folder in anyway.
Okay, I confirmed devtool: 'source-map'
in my webpack.config.js
file fixes the issue. However, it does seem strange that I have to turn on source maps. Having a source map is great for development, but we don't want to generate one for production.
@LandonSchropp seems unrelated to es6-promise though. Webpack should be dropping source-maps references if they are not used.
It does seem like a default webpack setup accidentally causes this:
If --devtool source-map is omitted, the output still contains the sourcemap URI, but in an invalid position resulting in the browser ignoring it.
Found that, at least with Webpack 4, this loader is necessary to prevent the issue: https://github.com/webpack-contrib/source-map-loader
Using @Hoten's solution, "devtool": "source-map"
does work, as do any of the other valid values for devtool
except none
. When I use none
I get a 404 error for the .map
file. Out of 13 packages I have installed, and all their dependent packages, this is the only one that throws the 404 warning, despite many of them have the same folder and file structure.
I'm using Webpack to incorporate the
es6-promise
polyfill as suggested in the readme:The problem is
dist/es6-promise.js
includes a reference to the source map file. While this is perfectly fine when copying the library into a repository, there's not really an easy way to include the map file in a standard Webpack build. The end result is this error in the browser:Would it be possible to generate a build without the source map comment for incorporating the library with Webpack or to inline the source map?