Reactjs 为什么我无法在chorme开发工具中看到ES6?
这就是我在Chrome中看到的 这是我的webpack.config.js 我尝试在各种值上更改devtools,但最终得到了相同的结果,project还使用了webpack dev server 所以我想知道我在哪里会犯错误 我想要什么Reactjs 为什么我无法在chorme开发工具中看到ES6?,reactjs,webpack,redux,google-chrome-devtools,webpack-dev-server,Reactjs,Webpack,Redux,Google Chrome Devtools,Webpack Dev Server,这就是我在Chrome中看到的 这是我的webpack.config.js 我尝试在各种值上更改devtools,但最终得到了相同的结果,project还使用了webpack dev server 所以我想知道我在哪里会犯错误 我想要什么 将devtool更新为devtool:'eval source map'将devtool更新为devtool:'eval source map'您希望看到什么?添加到我的问题中您的意思是在chrome开发工具中看不到您的imnport语句吗?我希望看到这些文件
将devtool更新为
devtool:'eval source map'
将devtool更新为devtool:'eval source map'
您希望看到什么?添加到我的问题中您的意思是在chrome开发工具中看不到您的imnport语句吗?我希望看到这些文件的原样。以ES6风格写作。我看到了编译后的文件,我想因为您使用的是babel loader和es2015presets loader,所以您必须将代码转换为es5,这就是您无法看到它的原因。您希望看到的到底是什么?添加到我的问题中,您的意思是您无法在chrome开发工具中看到imnport语句吗?我希望看到这些文件的原样。以ES6风格写作。我看到了编译后的文件,我想因为您使用的是babel loader和es2015presets loader,所以必须将代码转换为es5,这就是您无法看到它的原因。它只是将映射作为数据添加到bundle,而不是创建.map文件。请参阅,它只将映射作为数据添加到bundle,而不是创建.map文件。看见
module.exports = {
entry: {
vendors: [...],
bundle: './app/index.js',
},
output: {
path: __dirname + '/dist',
filename: '[name].js',
sourceMapFilename: "[name].js.map",
},
module: {
loaders: [{
test: /\.json$/,
loaders: ['json-loader'],
},{
test: /\.(js)$/,
loader: 'string-replace',
exclude: /node_modules/,
query: {
search: '/api/',
replace: !!apiUrl ? `${apiUrl}:${apiPortNumber}/api/` : '/api/',
flags: 'g'
}
},{
test: /\.(js)$/,
loader: 'string-replace',
exclude: /node_modules/,
query: {
search: '/dev-sse/',
replace: `${apiUrl}:`,
flags: 'g'
}
},{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: 'babel',
query: {
cacheDirectory: true,
plugins: ['transform-runtime', 'transform-decorators-legacy'],
presets: ['es2015', 'react', 'stage-0']
}
}
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin('vendors', 'commons.js'),
new HtmlWebpackPlugin({
template: __dirname + '/app/index.html',
filename: 'index.html',
inject: 'body'
}),
new CopyWebpackPlugin([
{ from: './assets/**/*' }
])
],
devtool: 'cheap-module-eval-source-map',
};