-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwebpack.common.js
More file actions
109 lines (108 loc) · 2.71 KB
/
webpack.common.js
File metadata and controls
109 lines (108 loc) · 2.71 KB
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
109
const webpack = require('webpack');
const path = require('path');
module.exports = {
entry: {
bootstrap: './renderers/bootstrap.js',
react: './renderers/react.js',
jquery: './renderers/jquery.js',
},
output: {
path: path.join(__dirname, 'dist'),
filename: 'rdforms.[name].js',
library: 'rdforms',
libraryTarget: 'umd',
},
plugins: [
// For plugins registered after the DojoAMDPlugin, data.request has been normalized and
// resolved to an absMid and loader-config maps and aliases have been applied
// new CleanWebpackPlugin(),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
jquery: 'jquery',
'window.jquery': 'jquery',
Popper: ['popper.js', 'default'],
}),
new webpack.IgnorePlugin({
resourceRegExp: /^\.\/locale$/,
contextRegExp: /moment/,
}),
],
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules\/(?!(@entryscape)\/).*/,
use: [
{
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: 3,
shippedProposals: true,
targets: { ie: 11 },
},
],
],
plugins: [
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-transform-class-properties',
'@babel/plugin-syntax-dynamic-import',
['@babel/plugin-transform-react-jsx', {}],
],
},
},
{
loader: 'ifdef-loader',
options: {
BLOCKS: false,
},
},
],
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.html$/,
use: ['raw-loader'],
},
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
type: 'asset/resource',
use: [
{
options: {
name: '[name].[ext]',
outputPath: 'fonts/',
publicPath: '../dist/fonts', // relative to HTML page (samples)
},
},
],
},
],
},
node: {
global: true,
},
resolve: {
mainFields: ['module', 'browser', 'main'],
alias: {
jquery: path.resolve(path.join(__dirname, 'node_modules', 'jquery')),
moment: path.resolve(path.join(__dirname, 'node_modules', 'moment')),
},
fallback: {
fs: false,
process: false,
},
},
stats: {
modules: true,
},
context: __dirname, // string (absolute path!)
};