mirror of
https://github.com/teslamate-org/teslamate.git
synced 2026-01-24 21:06:08 +08:00
56 lines
1.4 KiB
JavaScript
56 lines
1.4 KiB
JavaScript
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')
|
|
|
|
module.exports = (env, options) => ({
|
|
optimization: {
|
|
minimizer: [
|
|
new UglifyJsPlugin({ cache: true, parallel: true, sourceMap: false }),
|
|
new OptimizeCSSAssetsPlugin({})
|
|
]
|
|
},
|
|
entry: {
|
|
'./js/app.js': ['./js/app.js'].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: /\.s(c|a)ss$/,
|
|
use: [
|
|
MiniCssExtractPlugin.loader,
|
|
'css-loader',
|
|
{
|
|
loader: 'sass-loader',
|
|
options: {
|
|
implementation: require('sass')
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
|
loader: 'url-loader',
|
|
options: { limit: 10000 }
|
|
}
|
|
]
|
|
},
|
|
plugins: [
|
|
new MiniCssExtractPlugin({ filename: '../css/app.css' }),
|
|
new CopyWebpackPlugin([{ from: 'static/', to: '../' }])
|
|
]
|
|
})
|