似乎是一个真正愚蠢的问题,必须在某个地方有答案,但我已经搜索了几个小时但没有结果。我是 ReactJS 和使用 Webpack 构建的新手,一般来说是构建配置。我正在使用 Webpack 链接和捆绑我的整个项目,包括 ReactJS。它工作得很好,但我无法找到任何方法来使捆绑包不缩小,以便我可以在出现问题时进行调试。
这是我的 Webpack 配置:
var webpack = require('webpack');
var path = require('path');
var BUILD_DIR = path.resolve(__dirname, 'public/js');
var APP_DIR = path.resolve(__dirname, 'build-source/js');
var config = {
entry: APP_DIR + '\\main.js',
output: {
path: BUILD_DIR,
filename: 'build.js' // want this output file to end un-minified
},
module: {
loaders: [
{
test: /\.jsx?/,
include: APP_DIR,
loader: 'babel'
}
]
}
};
module.exports = config;
我运行捆绑执行npm run dev
or npm run build
它调用我的 package.json 中的以下内容:
{
/* blah blah */,
"scripts": {
"start": "node ./bin/www",
"dev": "webpack -d --watch",
"build": "webpack -p"
},
"dependencies": {
"babel-core": "^6.16.0",
"babel-loader": "^6.2.5",
"babel-preset-react": "^6.16.0",
"body-parser": "~1.15.1",
"cookie-parser": "~1.4.3",
"debug": "~2.2.0",
"express": "~4.13.4",
"helmet": "^3.1.0",
"morgan": "~1.7.0",
"mysql": "^2.11.1",
"querystring": "^0.2.0",
"react": "^15.3.2",
"react-dom": "^15.3.2",
"request": "^2.75.0",
"serve-favicon": "~2.3.0",
"webpack": "^1.13.2"
}
}
我需要改变什么才能得到未缩小的JavaScript 捆绑在我的 Webpack 执行之外?