在 webpack.config.js 的 module.exports 中加上 mode: 'production' 再運行 npm run webpack 就沒有那個警告了
2018-05-22
用webpack 4.8.3版本,我是按照npmjs.com的官網進行配置的
https://www.npmjs.com/package/autoprefixer
親測,成功
https://www.npmjs.com/package/autoprefixer
親測,成功
2018-05-22
隨便附上webpack中文官網的地址:
https://webpack.docschina.org/loaders/babel-loader
可以跑起來
不用謝,我是好人,(#^.^#)
https://webpack.docschina.org/loaders/babel-loader
可以跑起來
不用謝,我是好人,(#^.^#)
2018-05-21
目前使用的webpack的版本是4.8.3,而在webpack.config.js中的配置如下,
module:{
rules:[
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['env']
}
}
}
]
},
我參考的是webpack的中文官網
module:{
rules:[
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['env']
}
}
}
]
},
我參考的是webpack的中文官網
2018-05-21
之前是全局安裝的webpack,所以安裝html-webpack-glugin,運行時會報錯
Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
解決的方法就是重新再當前的文件夾下,在局部安裝一下,搞定
$ cnpm install webpack --save-dev
這里的cnpm我使用的是淘寶的鏡像
Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
解決的方法就是重新再當前的文件夾下,在局部安裝一下,搞定
$ cnpm install webpack --save-dev
這里的cnpm我使用的是淘寶的鏡像
2018-05-21
有沒有同學和我一樣,用webpack^4.8.1,哈哈踩坑無數,
這個autoprefixer 我時按照官網中的說法
要創建一個 postcss.config.js 才闊以
這個autoprefixer 我時按照官網中的說法
要創建一個 postcss.config.js 才闊以
2018-05-16
3.x
"webpack":"webpack --config webpack.config.js --progress --display-modules --colors --display-reasons"
加s
"webpack":"webpack --config webpack.config.js --progress --display-modules --colors --display-reasons"
加s
2018-05-15
exclude: path.resolve(__dirname, 'node_modules'),
include:/\.src/
這樣比兩個都用path.resolve速度快上10ms
include:/\.src/
這樣比兩個都用path.resolve速度快上10ms
2018-05-15
老師的額這個課程用的webpack版本是1.0,目前4.0的版本,從安裝到配置 好多都不一樣的,這個modue我是這樣寫的:
module:{
rules:[
{
test:/\.js$/,
exclude: __dirname + '/node_modules/',
use: {
loader: 'babel-loader',
options: {
presets: ["latest"]
}
}
}
]
}
module:{
rules:[
{
test:/\.js$/,
exclude: __dirname + '/node_modules/',
use: {
loader: 'babel-loader',
options: {
presets: ["latest"]
}
}
}
]
}
2018-05-14
1:我用的webpack 4.8.1運行webpack hello.js hello.bundle.js的時候提示錯誤,如下:
ERROR in multi ./hello.js hello.bundle.js
Module not found: Error: Can't resolve 'hello.bundle.js' in 'D:\learingFile\webpackLearning\day01'
@ multi ./hello.js hello.bundle.js
猜測可能是webpack的解析機制改了,把后面那個參數認為是一個模塊,需要npm來安裝這個模塊導致的。
ERROR in multi ./hello.js hello.bundle.js
Module not found: Error: Can't resolve 'hello.bundle.js' in 'D:\learingFile\webpackLearning\day01'
@ multi ./hello.js hello.bundle.js
猜測可能是webpack的解析機制改了,把后面那個參數認為是一個模塊,需要npm來安裝這個模塊導致的。
2018-05-10
如果提示API不對的話可能也是版本問題。最新版本的module引入loader的方式為:rules而非loaders。module:{
rules:[
{
test:/\.js$/,
loader:'babel-loader'
}
]
}
可以嘗試是否有效
rules:[
{
test:/\.js$/,
loader:'babel-loader'
}
]
}
可以嘗試是否有效
2018-05-10