-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.dev.js
68 lines (67 loc) · 1.59 KB
/
webpack.dev.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* eslint-disable license-header/header */
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const PreloadWebpackPlugin = require("@vue/preload-webpack-plugin");
const Dotenv = require("dotenv-webpack");
module.exports = {
mode: "development",
entry: "./src/js/index.js",
devtool: "source-map",
output: {
path: path.resolve(__dirname, "www"),
filename: "js/index.bundle.js",
assetModuleFilename: "css/assets/[hash][ext][query]"
},
devServer: {
static: {
directory: path.resolve(__dirname, "./www/data"),
publicPath: "/data"
}
},
plugins: [
new MiniCssExtractPlugin({
filename: "css/index.bundle.css",
}),
new HtmlWebpackPlugin({
template: "src/html/index.html"
}),
new PreloadWebpackPlugin({
rel: "preload",
as: "image",
include: "allAssets",
fileWhitelist: [/\.(png|jpe?g|gif|svg)$/],
includeHtmlNames: ["index.html"],
}),
new Dotenv(),
],
module: {
rules: [
{
test: /\.(?:js|mjs|cjs)$/,
use: {
loader: "babel-loader",
options: {
presets: [
["@babel/preset-env", { targets: {
"ios": "13"
}}]
]
}
}
},
{
test: /\.(scss|css)$/,
use: [
MiniCssExtractPlugin.loader,
"css-loader",
"sass-loader"
],
},
{
test: /\.(ttf|png|svg|jpg)$/,
type: "asset/resource",
}
]
},
};