如果document.getElementById("app")取不到值的话,那么可以app.js在外层加上window.onload=function(){},等dom树加载完后在取值
2017-08-29
exclude: __dirname +'./node_module/',
include: __dirname +'./src/',
Time: 312ms
include: __dirname +'./src/',
Time: 312ms
2017-08-29
ERROR in ./src/components/layer/layer.html
Module parse failed: E:\webpack\app\src\components\layer\layer.html Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
<div class="layer">
<div class="">
this is a layer
./src/components/layer/layer.js 1:0-30
./src/app.js
Module parse failed: E:\webpack\app\src\components\layer\layer.html Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
<div class="layer">
<div class="">
this is a layer
./src/components/layer/layer.js 1:0-30
./src/app.js
2017-08-28
@Lynnic,注意引入import Layer from './components/layer/layer.js'中Layer首字母大写,区分下边的layer
2017-08-28
老师的配置文件改一下下就好
const path = require('path');
module.exports = {
entry: './src/script/main.js',
output: {
path: path.resolve('./dist/js'),
filename: 'bundle.js'
}
}
const path = require('path');
module.exports = {
entry: './src/script/main.js',
output: {
path: path.resolve('./dist/js'),
filename: 'bundle.js'
}
}
2017-08-26
花了差不多一天时间看了一遍视频,发现老师讲的真心不错,清晰明了,把html、css、sass、less、图片、ejs、JavaScript、es6、jsx、vuet(jsx)、react(jsx)等等类型的webpack的核心功能都讲到了,包括entry、output、loader、plugin等配置的地方也讲到了,当然最大的缺陷是版本太老,还是讲的v1的东西,现在都已经到v3了,不过我还是硬着头皮结合最新的官网文档,根据老师的顺序,在v3版本上实现了一遍,发到github:https://github.com/mgss/webpack-study/ 了,各位有需要的可以看看~
2017-08-25