-
-
Save theangryangel/f601b336b27773bd735fb58e4c7d544f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const glob = require('glob'); | |
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | |
const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); | |
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); | |
const CopyWebpackPlugin = require('copy-webpack-plugin'); | |
const VueLoaderPlugin = require('vue-loader/lib/plugin'); | |
const css_loaders = [ | |
{ | |
loader: 'css-loader?sourceMap' | |
}, | |
{ | |
loader: 'postcss-loader?sourceMap' | |
}, | |
{ | |
loader: 'sass-loader?sourceMap' | |
} | |
]; | |
module.exports = (env, options) => ({ | |
optimization: { | |
minimizer: [ | |
new UglifyJsPlugin({ cache: true, parallel: true, sourceMap: false }), | |
new OptimizeCSSAssetsPlugin({}) | |
] | |
}, | |
entry: { | |
'./js/app.js': ['./js/app.js', './css/app.scss'].concat(glob.sync('./vendor/**/*.js')) | |
}, | |
output: { | |
filename: 'app.js', | |
path: path.resolve(__dirname, '../priv/static/js') | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
use: { | |
loader: 'babel-loader' | |
} | |
}, | |
{ | |
test: /\.vue$/, | |
loader: 'vue-loader' | |
}, | |
{ | |
test: /\.(scss|sass|css)$/i, | |
use: [ | |
MiniCssExtractPlugin.loader, | |
"css-loader", | |
"resolve-url-loader", | |
"sass-loader" | |
] | |
}, | |
{ | |
test: /\.(jpe?g|png|gif|woff|woff2|eot|ttf|svg)(\?[a-z0-9=.]+)?$/, | |
loader: 'url-loader?limit=100000' | |
} | |
] | |
}, | |
resolve: { | |
alias: { | |
'vue$': 'vue/dist/vue.esm.js' | |
}, | |
extensions: ['*', '.js', '.vue', '.json'] | |
}, | |
plugins: [ | |
new MiniCssExtractPlugin({ filename: 'css/app.css' }), | |
new CopyWebpackPlugin([{ from: 'static/', to: '../' }]), | |
new VueLoaderPlugin(), | |
] | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment