let dom =document.getElementById("app");
console.log(dom);
打印出来为空
Uncaught TypeError: Cannot set property 'innerHTML' of null
console.log(dom);
打印出来为空
Uncaught TypeError: Cannot set property 'innerHTML' of null
2018-01-21
报错Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API
schema.
schema.
2018-01-21
现在改到webpack3了,好多语法都变了。
const path = require('path');
module.exports = {
entry: './src/script/main.js',
output: {
path: path.resolve(__dirname, './dist/js'),
filename: 'bundle.js'
}
}
才能成功,不过老师讲的挺好的。
const path = require('path');
module.exports = {
entry: './src/script/main.js',
output: {
path: path.resolve(__dirname, './dist/js'),
filename: 'bundle.js'
}
}
才能成功,不过老师讲的挺好的。
2018-01-20
前人种树:
webpack3.x版本,在引入style-loader和css-loader时,如果其他错误都尝试修改了,打包还报错,那么仔细观察报错信息中是不是有还需要的模块,我的是json5和emojis-list模块,cnpm install 之后,再次打包就可以了。
webpack3.x版本,在引入style-loader和css-loader时,如果其他错误都尝试修改了,打包还报错,那么仔细观察报错信息中是不是有还需要的模块,我的是json5和emojis-list模块,cnpm install 之后,再次打包就可以了。
2018-01-19
webpack3.10.0图片打包到指定目录,亲测有效
{
test: /\.(png|svg|jpg|gif)$/,
use:[
{ loader: 'file-loader',
query:{
name:'images/[name]-[hash:5].[ext]'
} } ], }
{
test: /\.(png|svg|jpg|gif)$/,
use:[
{ loader: 'file-loader',
query:{
name:'images/[name]-[hash:5].[ext]'
} } ], }
2018-01-18
亲测webpack 3.10.0;先 npm install --save-dev autoprefixer
这样设置
rules:[{test: /\.css$/,use:[ 'style-loader', 'css-loader',
{loader: 'postcss-loader',
options: {
plugins:[ require('autoprefixer')()]
}
} ]}]
这样设置
rules:[{test: /\.css$/,use:[ 'style-loader', 'css-loader',
{loader: 'postcss-loader',
options: {
plugins:[ require('autoprefixer')()]
}
} ]}]
2018-01-18
最新回答 / 慕侠7925429
发现这样插入才行compilation.assets[htmlWebpackPlugin.files.chunks.a.entry.substr(htmlWebpackPlugin.files.publicPath.length).split('?')[0]]._value source方法报错,直接调用_value读取源码
2018-01-16
如果安装完之后说webpack不是内部命令可以使用如下方法:
在package.json中修改
{
"scripts": {
"start": "webpack"
}
}
在运行 npm run start 或者 npm start即可运行webpack命令
在package.json中修改
{
"scripts": {
"start": "webpack"
}
}
在运行 npm run start 或者 npm start即可运行webpack命令
2018-01-15