chemdemo / webpack-seed Goto Github PK
View Code? Open in Web Editor NEWFrontend engineering solution based on webpack and gulp.
License: MIT License
Frontend engineering solution based on webpack and gulp.
License: MIT License
一般都用长期维护版本,我向知道为什么要用node5.0 +
hi,
不经意间看到您的这份git, 看到下面这段htmlwebpackPlugin的用法很有意思:
// 自动生成入口文件,入口js名必须和入口文件名相同
// 例如,a页的入口文件是a.html,那么在js目录下必须有一个a.js作为入口文件
var pages = fs.readdirSync(srcDir);
pages.forEach(function(filename) {
var m = filename.match(/(.+)\.html$/);
if(m) {
// @see https://github.com/kangax/html-minifier
var conf = {
template: path.resolve(srcDir, filename),
// @see https://github.com/kangax/html-minifier
// minify: {
// collapseWhitespace: true,
// removeComments: true
// },
filename: filename
};
if(m[1] in config.entry) {
conf.inject = 'body';
conf.chunks = ['vendors', m[1]];
}
config.plugins.push(new HtmlWebpackPlugin(conf));
}
});
是不是这个配置会自动生成一个跟js名一样的html文件?这样的话方便好多,但是我的配置文件里头的格式是:
var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var BrowserSyncPlugin = require('browser-sync-webpack-plugin');
var Clean = require('clean-webpack-plugin');
module.exports = {
entry: {
header: path.resolve(__dirname, 'app/components/header/header.jsx'),
main: path.resolve(__dirname, 'app/main.js')
},
output: {
path: path.resolve(__dirname, 'build/public'),
filename: '[name].js'
},
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel'
},
{
test: /\.css$/,
loader: 'style!css'
}
]
},
plugins: [
//clean
new Clean(['build']),
//html
new HtmlWebpackPlugin({
title: 'jackyon webpack test',
template: 'test/my-index.html',
inject: 'body',
filename: 'header',
chunks: ['header']
}),
// new HtmlWebpackPlugin({
// title: 'another test',
// template: 'test/another.html',
// }),
//browserSync
new BrowserSyncPlugin({
host: 'localhost',
port: 3000,
server: { baseDir: ['build/public/'] }
})
]
};
请问如何修改才能运用您这种模式?
我看了下这个插件里头的文档,貌似里头没提到您这种方法,我觉得您的这种思路挺赞的。
请建议,谢谢
你好,我现在在解决一个多文件入口的html生成 看了你的解决方案,发现一个问题,
比如
a/
a.js
a.html
a.css
b/b.js
b.css
b.html
编译后输出的两个html里面的都包涵了inject了 a.js b.js的script
这是我的配置:
'use strict';
var path = require('path');
var webpack = require('webpack');
var vue = require('vue-loader');
var glob = require('glob');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var HtmlWebpackPlugin = require('html-webpack-plugin');
// path
var staDomain = 'http://admin.corp.dajia365.com';
var srcDir = path.resolve(process.cwd(), 'src');
var nodeModPath = path.resolve(__dirname, './node_modules');
var dest = 'build';
var alias = {
zpto: 'common/zpto/zpto',
fetch: 'common/fetch/fetch',
cookies:'common/util/cookies',
store: 'common/util/store'
};
// get entry path
var getEntry = function () {
var entry = {};
var jsDir = path.resolve(srcDir, 'app');
glob.sync(jsDir + '/**/page/*.js')
.forEach(function (name) {
var n = name.substring(name.lastIndexOf('src/') + 4 , name.lastIndexOf('.js'));
entry[n] = name;
});
return entry;
};
var htmlGenerator = function () {
var r = [];
var entryHtml = glob.sync(srcDir + '/app/**/*.html');
var entries = getEntry();
entryHtml.forEach(function (filePath) {
var filename = filePath.substring(filePath.lastIndexOf('src/') + 4, filePath.lastIndexOf('.'));
var re = new RegExp("(.{" + filename.lastIndexOf('/') + "})");
var jsFile = filename.replace(re, '$1/page');
var conf = {
template: filePath,
filename: filename + '.html'
};
if (jsFile in entries) {
conf.inject = 'body';
conf.trunks = ['lib', jsFile];
}
r.push(new HtmlWebpackPlugin(conf));
});
return r;
};
module.exports = function (options) {
options = options || {};
var debug = options.debug !== undefined ? options.debug : true;
var config = {
resolve:{
root: [srcDir, './node_modules'],
alias: Object.assign(alias, options.alias),
extensions: ['', '.js', '.css', '.scss', '.tpl', '.png', '.jpg']
},
entry: Object.assign(getEntry(), {
lib: [
'zpto',
'vue'
]
}),
output: {
path: path.resolve(options.dest || dest),
filename: "./[name].js",
publicPath: (options.domain || staDomain) + '/',
chunkFilename: "./[chunkhash:8].chunk.js"
},
module:{
loaders:[
{
test: /\.vue$/,
loader: "vue"
},
{
test: /\.(png|jpg|gif)$/,
loader: 'url?limit=1000&name=img/[name].[ext]'
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style-loader','css-loader')
}
]
},
plugins:[
new ExtractTextPlugin('./[name].css'),
new webpack.optimize.CommonsChunkPlugin('lib', 'lib.js', 2)
].concat(htmlGenerator()),
babel: { //配置babel
"presets": ["es2015"],
"plugins": ["transform-runtime"]
},
vue: { //vue的配置,需要单独出来配置
loaders: {
js: 'babel',
css: 'css-loader'
}
},
resolveLoader: {
root: path.join(__dirname, 'node_modules')
},
useMemoryFs: true,
progress: true
}
var vueLoader = {
js: 'babel',
css: ExtractTextPlugin.extract("vue-style-loader", "css-loader"),
sass: ExtractTextPlugin.extract("vue-style-loader", "css-loader", 'sass-loader')
};
if (!options.debug) {
config.vue.loaders = vueLoader;
config.plugins = (config.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.optimize.OccurenceOrderPlugin()
]);
} else {
config.devtool = 'source-map';
}
return config;
};
部分目录树:
src
│ ├── app
│ │ ├── ktm
│ │ │ ├── img
│ │ │ │ ├── i-add.png
│ │ │ │ ├── i-close.png
│ │ │ │ ├── i_logo.png
│ │ │ │ └── pic.jpg
│ │ │ ├── index.html
│ │ │ ├── page
│ │ │ │ ├── index.js
│ │ │ │ └── test.js
│ │ │ ├── style
│ │ │ │ ├── style.css
│ │ │ │ └── test.css
│ │ │ └── test.html
│ │ └── shaibei
│ │ ├── component
│ │ │ ├── popup.vue
│ │ │ └── test.vue
│ │ ├── img
│ │ │ ├── i_arr.png
│ │ │ ├── i_logo.png
│ │ │ ├── i_mi.png
│ │ │ ├── i_p.png
│ │ │ ├── i_password.png
│ │ │ ├── i_password_on.png
│ │ │ ├── i_rili.png
│ │ │ ├── i_search.png
│ │ │ ├── i_username.png
│ │ │ ├── i_username_on.png
│ │ │ ├── place_holder.png
│ │ │ ├── shaibei_backstage_0.5_z.png
│ │ │ └── user.jpg
│ │ ├── index.html
│ │ ├── page
│ │ │ └── index.js
│ │ └── style
│ │ └── style.css
请帮忙看下又啥问题么?
在a.css 文件里加了:
html,body{ background-color:red; }
页面没有变化?
你好,
我看了您最近的更新已经用设置template 用html loader的方式来解决inline的img src的问题了,十分感谢。
但是我在执行的时候 老是会报错:
ERROR in HtmlWebpackPlugin: Unable to read HTML template "html!E:\works\dim-web\src\pages\test.html"
路径都是正确的
谢谢
你好: bootstrap 引用 font 的路径有问题.我执行 build 后 生成的 css 引用 fonts 的路径 是 相对路径
“src:url(fonts/f4769f9b.glyphicons-halflings-regular.eot)”
请问我要如何才能解决它。
谢谢
make-webpack.config.js
line 42, 立即执行函数写法出错:
}())-->})()
line 80
}) --> })()
run build 之后a.css中找不到webpack.png
/app.js
if(debug) {
var webpackDevMiddleware = require('koa-webpack-dev-middleware');
var webpack = require('webpack');
var webpackDevConf = require('./webpack-dev.config');
app.use(webpackDevMiddleware(webpack(webpackDevConf), {
contentBase: webpackDevConf.output.path,
publicPath: webpackDevConf.output.publicPath,
hot: true,
// stats: webpackDevConf.devServer.stats
stats: {
cached: false,
colors: true
}
}));
}
hot: true 是开启HMR么?修改后好像不能更新
ERROR in Cannot find module 'node-sass'
@ ./src/js/c.js 12:0-25
安装node-sass后错误消失
如题, 非常感谢
如题,
已经安装 gulp 和 webpack 在全局,并且 npm install
我按照extract-text-webpack-plugin的文档加了?sourceMap后缀,但是并没有生成map文件。。。想问一下怎么可以生成map文件呢?
你好,请问下打包后的css background路径好像有点问题
类似于这个问题,
我不知道是否有更好的解决方案
谢谢
请问下,如果要做post可配置的代理,如何去写?
router.post('/captcha/:id', proxy({ url: 'http://10.118.22.32:8020/captcha/:id' }));
代码中id是写在url上的,后端同学用了restful的写法,请问有什么一劳永逸的代理写法吗?
谢谢
看您最近的更新在pathMap里添加了一些东西,没有看明白,想请教下
用npm安装的react包,使用require('react') 不就可以使用了么,为什么还需要写一个pathMap额??
let pathMap = Object.assign({
'react': path.join(nodeModPath, '/react/dist/react.js'),
'react-with-addons': path.join(nodeModPath, '/react/dist/react-with-addons.js'),
'react-dom': path.join(nodeModPath, '/react-dom/dist/react-dom.js'),
'jquery': path.join(nodeModPath, '/jquery/dist/jquery.js'),
'zepto': path.join(nodeModPath, '/zepto/zepto.min.js'),
}, pathMap),
您好,我clone了您的项目安装了node modules之后,执行指令npm run build报错,在最后
如果把gulpfile.js里的htmlminifier的内容注释掉就正常运行了。。。而且html也是压缩的
liupy525»~/Desktop/webpack-seed:master✘:✹⚡ npm run build
> [email protected] build /Users/liupy525/Desktop/webpack-seed
> gulp
[21:02:56] Using gulpfile ~/Desktop/webpack-seed/gulpfile.js
[21:02:56] Starting 'hint'...
src/js/b.js
line 18 col 1 'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
line 20 col 1 'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
line 21 col 1 'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
⚠ 3 warnings
src/js/helpers/ajax.js
line 35 col 29 Use '!==' to compare with '0'.
⚠ 1 warning
[21:02:56] Finished 'hint' after 312 ms
[21:02:56] Starting 'clean'...
[21:02:56] Finished 'clean' after 62 ms
[21:02:56] Starting 'pack'...
The unused option is deprecated. Please use options.discardUnused instead.
The urls option is deprecated. Please use options.normalizeUrl instead.
The idents option is deprecated. Please use options.mergeIdents instead.
The idents option is deprecated. Please use options.reduceIdents instead.
[21:03:00] [webpack] Hash: 9333747ff2ef0a48d796
Version: webpack 1.12.14
Time: 4019ms
Asset Size Chunks Chunk Names
js/30b83582.common-b-c.min.js 87 bytes 7 [emitted] common-b-c
img/0714810a.webpack.png 54.1 kB [emitted]
js/5dc5095f.chunk.min.js 418 bytes 1 [emitted]
js/16442b8d.chunk.min.js 316 bytes 2 [emitted]
js/6b7948c7.chunk.min.js 1.17 kB 3 [emitted]
js/8ea76dd3.b.min.js 137 bytes 4 [emitted] b
js/281d1653.c.min.js 834 bytes 5 [emitted] c
js/88ce5035.vender.min.js 39.2 kB 6 [emitted] vender
js/b86c321b.a.min.js 1.35 kB 0 [emitted] a
js/e66d2930.common.min.js 54.4 kB 8 [emitted] common
css/793a9847.a.min.css 85 bytes 0 [emitted] a
css/088e175c.b.min.css 20 bytes 4 [emitted] b
css/9b5d21ad.common.min.css 3.42 kB 8 [emitted] common
a.html 656 bytes [emitted]
b.html 2.73 kB [emitted]
c.html 495 bytes [emitted]
chunk {0} js/b86c321b.a.min.js, css/793a9847.a.min.css (a) 2.73 kB {8} [rendered]
[0] ./src/js/a.js 1.36 kB {0} [built]
[6] ./src/css/a.css 41 bytes {0} [built]
[8] ./src/img/webpack.png 70 bytes {0} [built]
[12] ./src/js/utils/url.js 1.26 kB {0} {5} [built]
chunk {1} js/5dc5095f.chunk.min.js 1.7 kB {0} [rendered]
[14] ./src/js/components/dialog.js 321 bytes {1} [built]
[15] ./src/css/components/dialog.css 961 bytes {1} [built]
[16] ./~/css-loader?minimize!./src/css/components/dialog.css 184 bytes {1} [built]
[17] ./src/js/components/mask.js 238 bytes {1} [built]
chunk {2} js/16442b8d.chunk.min.js 1.43 kB {0} [rendered]
[18] ./src/js/components/toast.js 286 bytes {2} [built]
[19] ./src/css/components/toast.css 958 bytes {2} [built]
[20] ./~/css-loader?minimize!./src/css/components/toast.css 183 bytes {2} [built]
chunk {3} js/6b7948c7.chunk.min.js 2.24 kB {0} [rendered]
[21] ./src/js/helpers/ajax.js 1.79 kB {3} [built]
[22] ./src/tmpl/list.tpl 454 bytes {3} [built]
chunk {4} js/8ea76dd3.b.min.js, css/088e175c.b.min.css (b) 404 bytes {7} [rendered]
[0] ./src/js/b.js 363 bytes {4} [built]
[23] ./src/css/b.css 41 bytes {4} [built]
chunk {5} js/281d1653.c.min.js (c) 1.63 kB {7} [rendered]
[0] ./src/js/c.js 372 bytes {5} [built]
[12] ./src/js/utils/url.js 1.26 kB {0} {5} [built]
chunk {6} js/88ce5035.vender.min.js (vender) 88.1 kB [rendered]
[0] multi vender 28 bytes {6} [built]
[9] ./src/js/lib/zepto.js 88.1 kB {6} [built]
chunk {7} js/30b83582.common-b-c.min.js (common-b-c) 51 bytes {8} [rendered]
[25] ./src/js/helpers/bar.js 51 bytes {7} [built]
chunk {8} js/e66d2930.common.min.js, css/9b5d21ad.common.min.css (common) 420 kB {6} [rendered]
[1] ./src/css/common.css 41 bytes {8} [built]
[3] ./~/css-loader/lib/css-base.js 1.51 kB {8} [built]
[5] ./~/style-loader/addStyles.js 6.09 kB {8} [built]
[10] ./~/lodash/index.js 411 kB {8} [built]
[11] ./~/webpack/buildin/module.js 251 bytes {8} [built]
[13] ./src/js/helpers/report.js 284 bytes {8} [built]
WARNING in js/b86c321b.a.min.js from UglifyJs
Side effects in initialization of unused variable dialog [./src/js/a.js:27,12]
Side effects in initialization of unused variable toast [./src/js/a.js:36,12]
Side effects in initialization of unused variable report [./src/js/a.js:21,4]
WARNING in js/5dc5095f.chunk.min.js from UglifyJs
Side effects in initialization of unused variable mask [./src/js/components/dialog.js:14,4]
Condition always false [./~/extract-text-webpack-plugin/loader.js?{"omit":1,"extract":true,"remove":true}!./~/style-loader!./~/css-loader?minimize!./src/css/components/dialog.css:10,0]
Dropping unreachable code [./~/extract-text-webpack-plugin/loader.js?{"omit":1,"extract":true,"remove":true}!./~/style-loader!./~/css-loader?minimize!./src/css/components/dialog.css:12,0]
Side effects in initialization of unused variable update [./~/extract-text-webpack-plugin/loader.js?{"omit":1,"extract":true,"remove":true}!./~/style-loader!./~/css-loader?minimize!./src/css/components/dialog.css:7,0]
WARNING in js/16442b8d.chunk.min.js from UglifyJs
Condition always false [./~/extract-text-webpack-plugin/loader.js?{"omit":1,"extract":true,"remove":true}!./~/style-loader!./~/css-loader?minimize!./src/css/components/toast.css:10,0]
Dropping unreachable code [./~/extract-text-webpack-plugin/loader.js?{"omit":1,"extract":true,"remove":true}!./~/style-loader!./~/css-loader?minimize!./src/css/components/toast.css:12,0]
Side effects in initialization of unused variable update [./~/extract-text-webpack-plugin/loader.js?{"omit":1,"extract":true,"remove":true}!./~/style-loader!./~/css-loader?minimize!./src/css/components/toast.css:7,0]
WARNING in js/6b7948c7.chunk.min.js from UglifyJs
Dropping unused function print [./~/ejs-loader!./src/tmpl/list.tpl:4,0]
Side effects in initialization of unused variable __j [./~/ejs-loader!./src/tmpl/list.tpl:3,0]
WARNING in js/8ea76dd3.b.min.js from UglifyJs
Side effects in initialization of unused variable _ [./src/js/b.js:18,6]
Side effects in initialization of unused variable report [./src/js/b.js:20,6]
Side effects in initialization of unused variable bar [./src/js/b.js:21,6]
WARNING in js/281d1653.c.min.js from UglifyJs
Side effects in initialization of unused variable _ [./src/js/c.js:17,4]
Side effects in initialization of unused variable report [./src/js/c.js:19,4]
Side effects in initialization of unused variable bar [./src/js/c.js:20,4]
Side effects in initialization of unused variable url [./src/js/c.js:21,4]
WARNING in js/88ce5035.vender.min.js from UglifyJs
Side effects in initialization of unused variable docElem [./src/js/lib/zepto.js:1811,34]
WARNING in js/e66d2930.common.min.js from UglifyJs
Side effects in initialization of unused variable sourceMap [./~/style-loader/addStyles.js:185,0]
Side effects in initialization of unused variable media [./~/style-loader/addStyles.js:203,0]
Condition always false [./~/style-loader/addStyles.js:23,0]
Dropping unreachable code [./~/style-loader/addStyles.js:24,0]
Side effects in initialization of unused variable support [node_modules/lodash/index.js:932,0]
Condition always true [node_modules/lodash/index.js:12323,0]
Dropping unreachable code [node_modules/lodash/index.js:12337,0]
Side effects in initialization of unused variable moduleExports [node_modules/lodash/index.js:266,0]
Child html-webpack-plugin for "a.html":
Asset Size Chunks Chunk Names
a.html 1.85 kB 0
chunk {0} a.html 429 bytes [rendered]
[0] ./~/html-loader!./src/a.html 429 bytes {0} [built]
Child html-webpack-plugin for "c.html":
Asset Size Chunks Chunk Names
c.html 1.69 kB 0
chunk {0} c.html 264 bytes [rendered]
[0] ./~/html-loader!./src/c.html 264 bytes {0} [built]
Child html-webpack-plugin for "b.html":
Asset Size Chunks Chunk Names
b.html 4 kB 0
chunk {0} b.html 2.51 kB [rendered]
[0] ./~/html-loader!./src/b.html 323 bytes {0} [built]
[1] ./src/img/icons/cart.png 2.19 kB {0} [built]
Child extract-text-webpack-plugin:
chunk {0} extract-text-webpack-plugin-output-filename 1.69 kB [rendered]
[0] ./~/css-loader?minimize!./src/css/b.css 179 bytes {0} [built]
[1] ./~/css-loader/lib/css-base.js 1.51 kB {0} [built]
Child extract-text-webpack-plugin:
chunk {0} extract-text-webpack-plugin-output-filename 5.14 kB [rendered]
[0] ./~/css-loader?minimize!./src/css/common.css 1.46 kB {0} [built]
[1] ./~/css-loader/lib/css-base.js 1.51 kB {0} [built]
[2] ./src/img/sprites-icons.png 2.18 kB {0} [built]
Child extract-text-webpack-plugin:
Asset Size Chunks Chunk Names
img/0714810a.webpack.png 54.1 kB
chunk {0} extract-text-webpack-plugin-output-filename 1.83 kB [rendered]
[0] ./~/css-loader?minimize!./src/css/a.css 257 bytes {0} [built]
[1] ./~/css-loader/lib/css-base.js 1.51 kB {0} [built]
[2] ./src/img/webpack.png 70 bytes {0} [built]
[21:03:00] Finished 'pack' after 5.98 s
[21:03:00] Starting 'default'...
events.js:154
throw er; // Unhandled 'error' event
^
Error: Parse Error: <img src=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAqCAYAAADI3bkcAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo0NEM0N0NCNjQ0OUFFNDExODZGN0Q3QjIwREM5MzZEMyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpEM0E0NTZEODlBNEUxMUU0OTVGQTgwMzIwNDRFNkZFRiIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpEM0E0NTZENzlBNEUxMUU0OTVGQTgwMzIwNDRFNkZFRiIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M2IChXaW5kb3dzKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjQ1QzQ3Q0I2NDQ5QUU0MTE4NkY3RDdCMjBEQzkzNkQzIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjQ0QzQ3Q0I2NDQ5QUU0MTE4NkY3RDdCMjBEQzkzNkQzIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+SD27/QAAAndJREFUeNrUmE1LG0EYx2fXVBDd9CCCEfUi9NAKFbIKFV+CGsGb157tFxBKPdlLP4EfwHO/QQWNUN9NyEXBWFp6811po9g3X9b+J0zqaLNv7mZm8sCPzc7uTv558p+ZZ1aLx+NLhJAechtfwXPwgwiIbDbr6369RFsb6CeKBhXcCzTGO9aeVFkwH3PsOFQpgtfBOWgHsUoQfAk+qpzlUoNuXmUflxJc9PFgpQjeAnugCTyrBMFK28JO8KyqttCwNJdqjzFbqBZrdhneB58VFPwi4nDxA3jCluu3Mosf0zSfssngUHe4T6VleoAdU06CF8EF6AKPJQse9iL4nNUWVSAhSyns8Igrdx0F87aQOR/TfzgKcvD7jptgFRaQIV6Lm+AMyLPZokWS4CT/b+tO0w245srNJGsT6d8oswQtexccBd/8vFgCNxPjr0fpeaKvfwrntUBkdulgo4Mug0SdebEE6TLNwnFjc6POsqyETDu4CS5sTltbWrWoYZx+z+fJanr9pWDBxeIr5UXwvzAMY7lQKG/nBgX6txkHuiRTK6R9CT4+OXlfEJzbahS4OS0mZwH+vSo22hY/nX3d9+tjay2T/oP2b4L9O+ulgP8vyWAT1JC7r7XKZQeNy/A8fy3iox/6Szv4ARCSOKfLO7DD9kMyTMIW6iE+gTf3G/1kmM4Uv0E1aACheDmMt5d28QussGekbU51n/dL34X4FZySXW7abfOdfuARqBegbRn+7g2aYQtMgi8ikhlGhqVs84NkWHpEAjw7AqbZ5zEwE8Kqd6dPZH8mzAxPs8otxn1J0HDtUy/nAClHn0EEvwIHYJdZIoxw7fOvAAMAw+irG/7RwKEAAAAASUVORK5CYII= /></p> <script src="js/88ce5035.vender.min.js"></script><script src="js/e66d2930.common.min.js"></script><script src="js/30b83582.common-b-c.min.js"></script><script src="js/8ea76dd3.b.min.js"></script></body> </html>
at new global.HTMLParser (/Users/liupy525/Desktop/webpack-seed/node_modules/html-minifier/src/htmlparser.js:243:15)
at minify (/Users/liupy525/Desktop/webpack-seed/node_modules/html-minifier/src/htmlminifier.js:826:5)
at Object.global.minify (/Users/liupy525/Desktop/webpack-seed/node_modules/html-minifier/src/htmlminifier.js:1176:12)
at objectAssign.fileName (/Users/liupy525/Desktop/webpack-seed/node_modules/gulp-htmlmin/index.js:22:39)
at module.exports (/Users/liupy525/Desktop/webpack-seed/node_modules/tryit/tryit.js:8:9)
at minifyHtml (/Users/liupy525/Desktop/webpack-seed/node_modules/gulp-htmlmin/index.js:21:9)
at Transform.htmlminTransform [as _transform] (/Users/liupy525/Desktop/webpack-seed/node_modules/gulp-htmlmin/index.js:51:7)
at Transform._read (/Users/liupy525/Desktop/webpack-seed/node_modules/gulp-htmlmin/node_modules/readable-stream/lib/_stream_transform.js:159:10)
at Transform._write (/Users/liupy525/Desktop/webpack-seed/node_modules/gulp-htmlmin/node_modules/readable-stream/lib/_stream_transform.js:147:83)
at doWrite (/Users/liupy525/Desktop/webpack-seed/node_modules/gulp-htmlmin/node_modules/readable-stream/lib/_stream_writable.js:313:64)
at writeOrBuffer (/Users/liupy525/Desktop/webpack-seed/node_modules/gulp-htmlmin/node_modules/readable-stream/lib/_stream_writable.js:302:5)
at Transform.Writable.write (/Users/liupy525/Desktop/webpack-seed/node_modules/gulp-htmlmin/node_modules/readable-stream/lib/_stream_writable.js:241:11)
at write (/Users/liupy525/Desktop/webpack-seed/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:623:24)
at flow (/Users/liupy525/Desktop/webpack-seed/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:632:7)
at DestroyableTransform.pipeOnReadable (/Users/liupy525/Desktop/webpack-seed/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:664:5)
at emitNone (events.js:80:13)
npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/Cellar/node/0.12.2_1/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v5.8.0
npm ERR! npm v3.8.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build: `gulp`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script 'gulp'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the webpack-seed package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! gulp
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs webpack-seed
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls webpack-seed
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/liupy525/Desktop/webpack-seed/npm-debug.log
[email protected] start-dev E:\Primeton\OpenSource\webpack-seed
node server/app
Listening at http://localhost:3010
GET /
GET /favicon.ico
webpack: wait until bundle finished: /favicon.ico
[BABEL] Note: The code generator has deoptimised the styling of "E:/Primeton/OpenSource/webpack-seed/node_modules/lodash/index.js" as it exceeds the max of "100KB".
events.js:160
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at exports._errnoException (util.js:896:11)
at Socket._writeGeneric (net.js:698:26)
at Socket._write (net.js:717:8)
at doWrite (_stream_writable.js:306:12)
at writeOrBuffer (_stream_writable.js:292:5)
at Socket.Writable.write (_stream_writable.js:220:11)
at Socket.write (net.js:643:40)
at Socket.Writable.end (_stream_writable.js:452:10)
at Socket.end (net.js:415:31)
at Through2._transform (E:\Primeton\OpenSource\webpack-seed\node_modules\imagemin-pngquant\index.js:92:12)
at Through2.Transform._read (E:\Primeton\OpenSource\webpack-seed\node_modules\through2\node_modules\readable-stream\lib_stream_transform.js:159:10)
at Through2.Transform._write (E:\Primeton\OpenSource\webpack-seed\node_modules\through2\node_modules\readable-stream\lib_stream_transform.js:147:83)
at doWrite (E:\Primeton\OpenSource\webpack-seed\node_modules\through2\node_modules\readable-stream\lib_stream_writable.js:313:64)
at writeOrBuffer (E:\Primeton\OpenSource\webpack-seed\node_modules\through2\node_modules\readable-stream\lib_stream_writable.js:302:5)
at Through2.Writable.write (E:\Primeton\OpenSource\webpack-seed\node_modules\through2\node_modules\readable-stream\lib_stream_writable.js:241:11)
at Through2.ondata (E:\Primeton\OpenSource\webpack-seed\node_modules\through2\node_modules\readable-stream\lib_stream_readable.js:531:20)
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "D:\Program Files\nodejs\node.exe" "D:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "start-dev"
npm ERR! node v6.0.0
npm ERR! npm v3.8.6
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start-dev: node server/app
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start-dev script 'node server/app'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the webpack-seed package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node server/app
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs webpack-seed
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls webpack-seed
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! E:\Primeton\OpenSource\webpack-seed\npm-debug.log
D:\github\webpack-seed\make-webpack.config.js:39
}())
^
SyntaxError: Unexpected token (
at Object.exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:513:28)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object. (D:\github\webpack-seed\webpack-dev.config.js:10:15)
at Module._compile (module.js:541:32)
对应的是 return map() 这里不用填参数吧? 那错误出现在哪里?
if(m[1] in config.entry) {
conf.inject = 'body';
conf.chunks = ['vendors', m[1]];
}
config.plugins.push(new HtmlWebpackPlugin(conf));
在build的文件看到b.html,c.html没有引用common-bc.js,这个问题怎么解决呢
两个问题:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.