-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwebpack.common.js
108 lines (107 loc) · 2.57 KB
/
webpack.common.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
const webpack = require('webpack')
const path = require('path')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const { VueLoaderPlugin } = require('vue-loader')
module.exports = {
entry: {
legal_advice_builder: [
'./legal_advice_builder/assets/scss/style.scss',
'bootstrap',
'bootstrap-icons/font/bootstrap-icons.css'
],
choice_field: [
'./legal_advice_builder/assets/js/forms/choice_field.js'
],
conditions_field: [
'/legal_advice_builder/assets/js/forms/conditions_field.js'
],
document_field: [
'/legal_advice_builder/assets/js/forms/document_field.js'
],
placeholder_list: [
'/legal_advice_builder/assets/js/document/placeholder_list.js'
]
},
resolve: {
fallback: {
"fs": false,
"tls": false,
"net": false,
"path": false,
"zlib": false,
"http": false,
"https": false,
"stream": false,
"crypto": false,
"_stream_transform": false,
"child_process": false,
"os": false,
"constants": require.resolve('constants-browserify'),
"crypto-browserify": require.resolve('crypto-browserify')
},
alias: {
'vue$': 'vue/dist/vue.esm.js'
},
extensions: ["*", ".js", ".vue", ".json"],
},
output: {
library: '[name]',
path: path.resolve('./legal_advice_builder/static/'),
publicPath: '/static/'
},
module: {
rules: [
{
test: /\.s?css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader'
]
},
{
test: /(fonts|files)\/.*\.(svg|woff2?|ttf|eot|otf)(\?.*)?$/,
loader: 'file-loader',
options: {
name: 'fonts/[name].[ext]'
}
},
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
},
},
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.svg$|\.png$/,
loader: 'file-loader',
options: {
name: 'images/[name].[ext]'
}
}
]
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[name].css'
}),
new CopyWebpackPlugin({
patterns: [{
from: './legal_advice_builder/assets/js/snippets/**/*',
to: 'js/snippets/[name][ext]'
}]
}),
new VueLoaderPlugin(),
new webpack.ProvidePlugin({
process: 'process/browser.js',
Buffer: ['buffer', 'Buffer'],
}),
]
}