webpack: webpack sourcemaps do not work well with ES6 imports
Do you want to request a feature or report a bug? Report a bug.
What is the current behavior?
Sourcemaps do not work for ES6 imports
Example: import foo from '../src/fooProvider'
will be visible as __WEBPACK_IMPORTED_MODULE_0__src__fooProvider__.a
Using require
and module.exports
will correctly make foo
available in the debugger scope.
If the current behavior is a bug, please provide the steps to reproduce.
- Clone minimal project: https://git-r3lab.uni.lu/sascha.herzinger/debugger-bug.git
- npm install
- run karma to see if everything works
- run karma with breakpoint in test/foo-test.js line 6
- See messed up scope as shown here:
What is the expected behavior?
being able to inspect foo
instead of __WEBPACK_IMPORTED_MODULE_0__src__fooProvider__.a
when using ES6 imports.
I want to see this, but with ES6 imports:
Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System. Chrome 56, node 7.7.1, webpack (s. package.json) Webstorm 2017.1 macOS 10.12.3
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 4
- Comments: 23 (4 by maintainers)
@abirmingham 4. People have lost hope.
I’m a little bewildered as to why there is such little activity on this issue. Sourcemaps should work. I can only think of a few explanations:
Anyone know which of the above is true, if any? Thanks!
I’m interested in working on this and willing to commit time to it, I’d love if I could get some pointers on where I could get started solving this.
@sokra @bebraw
@sherzinger I wasn’t able to open the minimal reproduction case, could you make sure it’s public?
@Vanuan As I understand, transforming imports with Babel not just makes your build slower, it removes all useful features that ES Modules give (static checks, tree shaking, concatenation, etc.).
I’m running into this as well. I’d like to avoid adding Babel because it adds 30 seconds to my build.
@sherzinger No, this is related to disabling babel ES6 module transform (
{modules:false}
).I.e. webpack adds
__WEBPACK_IMPORTED_MODULE_...
to global namespace but doesn’t add corresponding local variables.New issue created: #9461
@sherzinger I’m saying that if you’d use
babel
for module tranformation the problem would gone