내 반응 프로젝트에 webpack 및 es2015를 사용하고 있지만 es2016으로 업데이트하고 싶습니다. 나는 npm을 사용하여 새 사전 설정을 설치 한 다음 내 .babelrc를 변경하는 것만 큼 쉽지만, 내 es2015 구문을 모두 사용하면 오류가 발생합니다. 나는 es2016이 나의 약간의 에러로 인해 단순히 로딩되지 않는다고 가정한다. 이것은 내 webpack.config.jsEs2016 가져 오기 작동하지 않음
var webpack = require('webpack');
var path = require('path');
var BUILD_DIR = path.resolve(__dirname, 'src/client/public');
var APP_DIR = path.resolve(__dirname, 'src/client/app');
var config = {
entry: APP_DIR + '/index.jsx',
output: {
path: BUILD_DIR,
filename: 'bundle.js'
},
module : {
loaders : [
{
test : /\.jsx?/,
include : APP_DIR,
loader : 'babel-loader',
query: {
presets: ['es2016']
}
},
{
test: /\.css$/,
loader: 'style-loader'
},
{
test: /\.css$/,
loader: 'css-loader',
query: {
modules: true,
localIdentName: '[name]__[local]___[hash:base64:5]'
}
},
{
test: /\.json$/,
loader: 'json-loader'
}
]
},
node: {
fs: 'empty',
net: 'empty',
tls: 'empty'
}
};
module.exports = config;
Uncaught SyntaxError: Unexpected token import
입니다
던져 정확한 오류가되는 것은이
{
"presets" : ["es2016", "react"]
}