var path=require('path');
module.exports={
entry:{
bundle:['./src/script/a.js','./src/script/b.js']
},
output:{
path:path.join(__dirname,'./dist/js'),
//两杠的dirname
filename:'[name].js'
}
}
module.exports={
entry:{
bundle:['./src/script/a.js','./src/script/b.js']
},
output:{
path:path.join(__dirname,'./dist/js'),
//两杠的dirname
filename:'[name].js'
}
}
2017-04-09
官方文档上描述:
{
entry: {
a: "./a",
b: "./b",
c: ["./c", "./d"]
},
output: {
path: path.join(__dirname, "dist"),
filename: "[name].entry.js"
}
}
{
entry: {
a: "./a",
b: "./b",
c: ["./c", "./d"]
},
output: {
path: path.join(__dirname, "dist"),
filename: "[name].entry.js"
}
}
2017-04-09
module: {rules: [{test: /\.css$/, loader: ['style-loader', {loader: 'css-loader', options: {importLoaders: 1 } }, {loader: 'postcss-loader', options: {plugins: function() {return [require('autoprefixer')]; } } }] }] } webpack.config.js的同级目录配置一个postcss.config.js文件,内容看其他评论,字数要超了
2017-04-09
用image-webpack-loader还是报这个错误
ERROR in Error: Child compilation failed:
Module build failed: TypeError: Cannot read property 'bypassOnDebug' of null
- TypeError: Cannot read property 'bypassOnDebug' of null
ERROR in Error: Child compilation failed:
Module build failed: TypeError: Cannot read property 'bypassOnDebug' of null
- TypeError: Cannot read property 'bypassOnDebug' of null
2017-04-09
我用 webpack 2.3.3 用image-webpack-loader 会报 cannot read property 'bypassOnDebug' of null 调了半天还是报错。。
2017-04-09
//指定loader的参数,告诉babel怎么处理我们的js,需要使用那些es6的特性
// presets: ['lastest']//lastest是babel loader的一个插件,也需要安装:https://babeljs.io/docs/plugins/
"presets": [//上面的方式已经被弃用,缓存env
["env", {
...
// presets: ['lastest']//lastest是babel loader的一个插件,也需要安装:https://babeljs.io/docs/plugins/
"presets": [//上面的方式已经被弃用,缓存env
["env", {
...
2017-04-08
太坑了webpack 2.0版,配置都大不相同,以下两种写法都不行啊
//写法一
loader:'style-loader!css-loader!postcss-loader!less-loader'
// 写法二
use:[
'style-loader',
'css-loader',
'postcss-loader',
'less-loader'
]
//写法一
loader:'style-loader!css-loader!postcss-loader!less-loader'
// 写法二
use:[
'style-loader',
'css-loader',
'postcss-loader',
'less-loader'
]
2017-04-08
webpack2.0版本的正确配置
module: {
rules: [
{
test: /\.js$/,
loader: "babel-loader",
query: {
presets: ['env']
},
include: [
path.resolve(__dirname,'src')
],
exclude: /node_modules/
}
]
},
module: {
rules: [
{
test: /\.js$/,
loader: "babel-loader",
query: {
presets: ['env']
},
include: [
path.resolve(__dirname,'src')
],
exclude: /node_modules/
}
]
},
2017-04-07
老师使用的webpack应该是1.0版本,在2.0可以这样写,就不会报错:
module.exports = {
entry:'./src/script/main.js',
output:{
filename:'./dist/bundle.js'
}
}
module.exports = {
entry:'./src/script/main.js',
output:{
filename:'./dist/bundle.js'
}
}
2017-04-07