-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
59 lines (58 loc) · 1.39 KB
/
webpack.config.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
'use strict';
const path = require('path');
const webpack = require('webpack');
/**
* WebpackによるJSコンパイル設定
* @type {Object}
*
* modeをproductionにすると圧縮された状態で出力される
* 通常はdevelopmentを設定しておく
*/
module.exports = {
mode: "development",
entry: "./origin/_js/script.js", // 結合のメインとなるJSファイルパス
output: {
path: path.resolve(__dirname, '/public/_asset/js'), // 出力先ディレクトリ
filename: "script.js" // 出力時のファイル名
},
module: {
rules: [
{
test: /\.css$/,
use: [
{
loader:'style-loader',
options: {
insertAt: {
before: '#stylecss' // 結合したスタイルのDOM内での出力先
}
}
},
{
loader: 'css-loader',
options: {
url: false
}
}
]
},
{
test: /\.js$/,
use: [{
loader: 'babel-loader',
options: {
presets: [
'@babel/preset-env'
]
}
}]
}
]
},
plugins: [
new webpack.ProvidePlugin({
$: path.resolve(__dirname, './origin/_js/vender/jquery-3.6.0.min.js'),
jQuery: path.resolve(__dirname, './origin/_js/vender/jquery-3.6.0.min.js'),
})
]
}