1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/hkgit-angular1_webpack2

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
webpack.config.js 2.7 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
kaikai Отправлено 17.10.2017 13:48 ee5f6eb
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'
})
]
};

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/hkgit-angular1_webpack2.git
git@api.gitlife.ru:oschina-mirror/hkgit-angular1_webpack2.git
oschina-mirror
hkgit-angular1_webpack2
hkgit-angular1_webpack2
master