mirror of
https://github.com/netfun2000/hipudding-teslamate.git
synced 2026-02-27 09:44:28 +08:00
69 lines
1.7 KiB
JavaScript
69 lines
1.7 KiB
JavaScript
const path = require("path");
|
|
const glob = require("glob");
|
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
const TerserPlugin = require("terser-webpack-plugin");
|
|
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
|
|
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
|
|
|
module.exports = (env, options) => ({
|
|
optimization: {
|
|
minimize: true,
|
|
minimizer: [
|
|
new TerserPlugin({ cache: true, parallel: true, sourceMap: false }),
|
|
new OptimizeCSSAssetsPlugin({}),
|
|
],
|
|
},
|
|
entry: {
|
|
app: glob.sync("./vendor/**/*.js").concat(["./js/app.js"]),
|
|
},
|
|
output: {
|
|
publicPath: "/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,
|
|
name: "../images/[name].[contenthash:7].[ext]",
|
|
},
|
|
},
|
|
|
|
{
|
|
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
|
loader: "url-loader",
|
|
options: {
|
|
limit: 10000,
|
|
name: "../fonts/[name].[contenthash:7].[ext]",
|
|
},
|
|
},
|
|
],
|
|
},
|
|
plugins: [
|
|
new MiniCssExtractPlugin({ filename: "../css/app.css" }),
|
|
new CopyWebpackPlugin({ patterns: [{ from: "static/", to: "../" }] }),
|
|
],
|
|
});
|