1 Star 3 Fork 3

kaikai/angular1_webpack2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.config.js 2.70 KB
一键复制 编辑 原始数据 按行查看 历史
kaikai 提交于 2017-10-17 18:48 +08:00 . no commit message
const path = require('path');
const webpack = require('webpack');
const htmlWebpackPlugin = require('html-webpack-plugin');
const autoprefixer = require('autoprefixer');
module.exports = {
devtool: 'inline-source-map',
entry: {
app: './app/app.main.js',
vendor: ['angular', 'angular-animate', 'angular-toastr', 'angular-ui-bootstrap', 'angular-ui-grid', 'angular-ui-router', 'bootstrap', 'echarts', 'jquery', 'oi.select']
},
output: {
path: path.join(__dirname, 'build'),
filename: 'js/[name].[hash:8].js',
chunkFilename: "chunks/[name].chunk.[hash:8].js"
},
resolve: {
extensions: ['.js', '.ts', '.json', '.html', '.less', '.css'],
modules: [path.join(__dirname, "app"), "node_modules"],
alias: {
jquery: "jquery/dist/jquery.min" /* 引入jquery */
}
},
module: {
rules: [{
test: /\.html$/,
use: ['raw-loader'],
exclude: /node_modules/
}, {
test: /\.js(x)*$/,
use: ['babel-loader'],
exclude: /node_modules/
}, {
test: /\.less$/,
use: ['style-loader', 'css-loader', 'less-loader', 'postcss-loader'],
include: path.join(__dirname, 'app')
}, {
test: /\.css$/,
use: ['style-loader', 'css-loader', 'postcss-loader']
}, {
test: /\.(jpg|png|gif|ico)$/,
use: ['file-loader?name=./img/[name].[ext]']
}, {
test: /\.(woff|woff2|eot|ttf|svg)$/,
use: ['url-loader?limit:10000&name=./fonts/[name].[ext]']
}]
},
plugins: [
new webpack.NamedModulesPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.HashedModuleIdsPlugin(),
new webpack.LoaderOptionsPlugin({
options: {
postcss: function() { return [autoprefixer({ browsers: ['last 2 versions'] })] }
},
devServer: {
port: 8080,
historyApiFallback: true
}
}),
new webpack.optimize.CommonsChunkPlugin({
names: ['vendor', 'manifest'],
minChunks: function(module) {
return module.context && module.context.indexOf('node_modules') !== -1;
}
}),
new htmlWebpackPlugin({
template: path.resolve(__dirname, 'app/index.html'),
favicon: path.resolve(__dirname, 'app/img/favicon.ico')
}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
})
]
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/hkgit/angular1_webpack2.git
git@gitee.com:hkgit/angular1_webpack2.git
hkgit
angular1_webpack2
angular1_webpack2
master

搜索帮助