You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please tell us about your environment:
OSX 10.12.5
Current behavior:
Using the babel-loader loader with the transform-object-rest-spread plugin fails to compile properly:
ERROR in ./src/js/reducers/AppReducer.js
Module parse failed: /src/js/reducers/AppReducer.js Unexpected token (2:10)
You may need an appropriate loader to handle this file type.
| let a = { 'x': 1, 'y': 2 };
| let b = { ...a, 'z': 3 };
|
| console.log(b);
@ ./src/js/application.js 4:0-51
Expected/desired behavior:
Webpack should compile with the transform-object-rest-spread plugin properly, as it does when invoked manually:
λ ./node_modules/.bin/babel src/js/reducers/AppReducer.js
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var a = { 'x': 1, 'y': 2 };
var b = _extends({}, a, { 'z': 3 });
console.log(b);
Strongly inclined to believe that babel-loader itself is the source of the issue, as files appear to compile normally when babel is manually invoked (see above).
Removing the transform-object-rest-spread plugin and adding the stage-3 preset (which contains the object rest spread proposal) also appears to have no effect. Force upgrading and re-installing all of the above dependencies appears to have no effect either.
Is this a known issue? Searching around, it seems that many others seem to run into the same problem and are rarely able to solve it.
The text was updated successfully, but these errors were encountered:
Huh. Normally that include has a few path.resolve lines present (ostensibly to add a few directories to the PATH), but that isn't how include works, and beyond that, include doesn't work the way I would have guessed it did in the first place now that I'm examining it.
Removing the include here entirely appears to solve the issue, although I have no idea how this ever compiled in the first place if what it really meant was that it ONLY applied those rules to the files in 'X' directories.
Does Webpack have some inferred ES6 transpilation built in?!
You're probably testing your code in an environment that supports ES6. Object-spread isn't standard yet, so Webpack can't process it, but any standardized syntax will pass through Webpack into the output file with no problem.
I'm submitting a bug report
Webpack Version:
3.4.1
Babel Core Version:
6.25
Babel Loader Version:
7.1.1
Please tell us about your environment:
OSX 10.12.5
Current behavior:
Using the
babel-loader
loader with thetransform-object-rest-spread
plugin fails to compile properly:Expected/desired behavior:
Webpack should compile with the
transform-object-rest-spread
plugin properly, as it does when invoked manually:Relevant portion of
webpack.config.js
:.babelrc
Relevant portion of `package.json``
Strongly inclined to believe that
babel-loader
itself is the source of the issue, as files appear to compile normally when babel is manually invoked (see above).Removing the
transform-object-rest-spread
plugin and adding thestage-3
preset (which contains the object rest spread proposal) also appears to have no effect. Force upgrading and re-installing all of the above dependencies appears to have no effect either.Is this a known issue? Searching around, it seems that many others seem to run into the same problem and are rarely able to solve it.
The text was updated successfully, but these errors were encountered: