84669 personnes étudient
152542 personnes étudient
20005 personnes étudient
5487 personnes étudient
7821 personnes étudient
359900 personnes étudient
3350 personnes étudient
180660 personnes étudient
48569 personnes étudient
18603 personnes étudient
40936 personnes étudient
1549 personnes étudient
1183 personnes étudient
32909 personnes étudient
网上大多是关于单页项目的配置教程,偶尔搜到一篇多页面配置的,又会加入一些乱七八糟的其他插件和功能把你弄晕,哪里有关于多页面的配置教程啊?就是普通网站开发的多页面,有index.html,servise.html,about.html,contact.html,等等。
走同样的路,发现不同的人生
webpack 多页其实就是配置多个 entry 入口,然后建立对应的 html 模版
https://webpack.js.org/guides...
如果只是几个页面,完全可以做成单页面应用,用路由和webpack做成按需加载,也是挺不错的
我以前用过一个但是是很简单,多页面的。/webpack.config.js/
var path = require('path'); module.exports = { entry:{ main:'./src/main.js', list:'./src/list.js', subject:'./src/subject.js', more:'./src/more.js', }, output:{ path:path.resolve(__dirname,'build'), filename:'[name].bundle.js' }, module:{ loaders:[ { test:/\.js[x]?$/, loader:'babel', query:{ presets:['react','es2015'] } }, { test:/\.css$/, loader:'style!css' }, { test:/\.less$/, loader:'style!css!less' }, { test:/\.(png|jpg|gif)$/, loader:'url?limit=8192' } ] }, devServer:{ historyApiFallback:true, hot:true, inline:true, progress:true, port:7070 } }
最后生成的文件目录!
如果输出目录你可以接受在单一目录下的话配置多个entry入口是可以解决的,但是如果是你要求输出目录是多个目录的话可能需要结合gulp这些工具一起使用(ps:我是这样这样解决的)
今天刚好撸了一个脚手架 https://github.com/fe-config/...
应该是你要的
webpack 多页其实就是配置多个 entry 入口,然后建立对应的 html 模版
https://webpack.js.org/guides...
如果只是几个页面,完全可以做成单页面应用,用路由和webpack做成按需加载,也是挺不错的
我以前用过一个但是是很简单,多页面的。
/webpack.config.js/
最后生成的文件目录!
如果输出目录你可以接受在单一目录下的话配置多个entry入口是可以解决的,但是如果是你要求输出目录是多个目录的话可能需要结合gulp这些工具一起使用(ps:我是这样这样解决的)
今天刚好撸了一个脚手架 https://github.com/fe-config/...
应该是你要的