このエラーが発生し、他の回答が表示されましたが、解決策で問題が解決されません。私のpackage.jsonでエラーを解決するには:SyntaxError:予期しないトークンのインポート
私が持っている:私のwebpack.config.jsで、その後
"dependencies": {
"axios": "^0.15.2",
"babel": "^6.5.2",
"babel-core": "^6.13.1",
"babel-loader": "^6.0.1",
"babel-preset-es2015": "^6.0.15",
"babel-preset-node5": "^11.1.0",
"babel-preset-react": "^6.0.15",
"babel-preset-stage-0": "^6.0.15",
"babel-preset-stage-2": "^6.11.0",
私が持っている:私のmain.jsで、その後
module.exports = {
entry: './main.js',
私が持っている:
import "./src";
このスクリプトを呼び出すnpm test
を実行します。
"scripts": {
"test": "mocha src/**/*.spec.js",
およびSRC /コンポーネント/ヘッダ/ index.spec.js内部ので、それは失敗します。私が持っている1:それは
を働く習慣なぜimport React from 'react';
はうまくカント私はこれで.babelrc
ファイルを持っています中:私のWebPACKでも
{
"sourceMaps": true,
"presets": ["es2015", "react", "stage-2"]
}
私が持っている:
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015', 'react', 'stage-2']
}
},
{
test: /\.scss$/,
loaders: ["style-loader", "css-loader", "sass-loader"]
}
]
}
アイデア?
歓声、非常に役立つ –