1 Star 0 Fork 299

良木 / framework-admin

forked from backflow / framework-admin 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.config.js 3.24 KB
一键复制 编辑 原始数据 按行查看 历史
var path = require('path')
var webpack = require('webpack')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
module.exports = {
entry: {
app: './src/main.js'
},
output: {
path: path.resolve(__dirname, './dist'),
filename: '[name].js',
publicPath: '/dist/'
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
extractCSS: true,
loaders: {
// Since sass-loader (weirdly) has SCSS as its default parse mode, we map
// the "scss" and "sass" values for the lang attribute to the right configs here.
// other preprocessors should work out of the box, no loader config like this necessary.
sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax',
scss: 'vue-style-loader!css-loader!sass-loader',
css: ExtractTextPlugin.extract({
fallback: 'vue-style-loader',
use: 'css-loader'
})
}
}
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: {
loader: 'css-loader',
options: {
sourceMap: true
}
}
})
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash:8]'
}
},
{
test: /\.(ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/,
loader: 'file-loader?name=fonts/[name].[ext]'
},
{
test: require.resolve('jquery'), // 此loader配置项的目标是NPM中的jquery
loader: 'expose-loader?$!expose-loader?jQuery' // 先把jQuery对象声明成为全局变量`jQuery`,再通过管道进一步又声明成为全局变量`$`
}
]
},
resolve: {
alias: {
'toastr$': path.resolve(__dirname, 'src/misc/toastr.esm.js'),
'jquery$': 'jquery/dist/jquery.slim.min.js', // 使用jQuery slim 版本替换完整版jQuery
'vue$': 'vue/dist/vue.esm.js'
}
},
externals: {
localStorage: 'window.localStorage'
},
devServer: {
historyApiFallback: true,
noInfo: true
},
performance: {
hints: false
},
plugins: [
new webpack.ProvidePlugin({
Tether: 'tether',
jQuery: 'jquery',
$: 'jquery'
}),
new ExtractTextPlugin('app.css')
],
devtool: '#eval-source-map'
}
if (process.env.NODE_ENV === 'production') {
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
// Compress extracted CSS. We are using this plugin so that possible
// duplicated CSS from different components can be deduped.
new OptimizeCSSPlugin({
cssProcessorOptions: {
safe: true
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
])
}
JavaScript
1
https://gitee.com/eway/framework-admin.git
git@gitee.com:eway/framework-admin.git
eway
framework-admin
framework-admin
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891