windows 下的配置
module.exports = {
entry: "./src/script/main.js",
output: {
path: __dirname+"/dist/js",
filename: "bundle.js"
}
};
module.exports = {
entry: "./src/script/main.js",
output: {
path: __dirname+"/dist/js",
filename: "bundle.js"
}
};
2017-10-13
html-loader 好像要跟html-webpack-plugin要冲突,配置html-loader的时候最好指定include,不然应该会报错。我的运行环境是webpack3.6,"html-loader": "^0.5.1","html-webpack-plugin": "^2.30.1"。
2017-10-13
module.exports = {
entry: path.join(__dirname, './src/js/main.js'), // 指定打包的JS入口文件
output: { // 打包好的输出
path: path.join(__dirname, './dist'),
filename: 'bundle.js'
},
module: { // 所有第三方loader配置节点
rules: [
{ test: /\.css$/, use: ['style-loader', 'css-loader'] },
]
}
}
entry: path.join(__dirname, './src/js/main.js'), // 指定打包的JS入口文件
output: { // 打包好的输出
path: path.join(__dirname, './dist'),
filename: 'bundle.js'
},
module: { // 所有第三方loader配置节点
rules: [
{ test: /\.css$/, use: ['style-loader', 'css-loader'] },
]
}
}
2017-10-10
@炮哥炮炮的,webpack2.0亲测可行,吗的慕课网评论限制300字真的zz,还搞什么程序学习,随便粘贴点代码就不止300个字了,mmp
2017-10-10
{test:/\.(jpg|png|gif|svg)$/i,loaders: [{loader:'url-loader', options: {limit: 10000,name:'img/[name].[ext]'}}, {loader: 'image-webpack-loader',options: {gifsicle: {interlaced: false},optipng: {optimizationLevel: 7},pngquant: {quality: '65-90',speed: 4},mozjpeg: {progressive: true,quality: 65}}}]}
2017-10-10
可以看下你们的程序编译成功了么,我的一开始编译出来没有成功 const还是const。
之后webpack.config.js 头部添加 var path = require('path');
然后include这样写include:[ path.resolve(__dirname,'src/') ],
部分编译的结果如下:
var app = function app() {
var NUM = 1;
alert(NUM);
console.log(_layer2.default);
};
实测exclude路径的写法同上的时候才会生效。不知道484版本的问题。
之后webpack.config.js 头部添加 var path = require('path');
然后include这样写include:[ path.resolve(__dirname,'src/') ],
部分编译的结果如下:
var app = function app() {
var NUM = 1;
alert(NUM);
console.log(_layer2.default);
};
实测exclude路径的写法同上的时候才会生效。不知道484版本的问题。
2017-10-09
ERROR in multi ./src/script/main.js main.js bundle.js
Module not found: Error: Can't resolve 'bundle.js' in 'E:\webpack-demo111'
@ multi ./src/script/main.js main.js bundle.js
module.exports = {
entry: './src/script/main.js',
output: {
path: __dirname + '/dist/js',
filename: 'bundle.js'
}
}
Module not found: Error: Can't resolve 'bundle.js' in 'E:\webpack-demo111'
@ multi ./src/script/main.js main.js bundle.js
module.exports = {
entry: './src/script/main.js',
output: {
path: __dirname + '/dist/js',
filename: 'bundle.js'
}
}
2017-10-08