首页 > 代码库 > Webpack入门教程十

Webpack入门教程十

57.注释插件(BannerPlugin)使用,修改webpack.config.js配置文件,修改内容如下

var webpack = require(‘webpack‘);

module.exports = {
	entry:  __dirname + "/app/Greeter.js",
	output: {
		path: __dirname + "/public",
		filename: "bundle.js"
	},
	devServer:{
		contentBase:"./public",
		historyApiFallback:true,
		inline:true
	},
	module:{
		loaders:[
			{
				test:/\.json$/,
				loader:"json-loader"
			},
			{
				test:/\.js$/,
				exclude:/node_modules/,
				loader:‘babel-loader‘
			},
			{
				test:/\.css$/,
				loader:‘style-loader!css-loader?modules‘
			}
		]
	},
	plugins:[
		new webpack.BannerPlugin("copyright suyan")
	]
}

58.使用webpack命令打包

webpack

技术分享

59.查看bundle.js文件

技术分享技术分享


本文出自 “素颜” 博客,请务必保留此出处http://suyanzhu.blog.51cto.com/8050189/1899095

Webpack入门教程十