Repository navigation
Expand file tree
/
Copy pathwebpack.config.js
More file actions
114 lines (110 loc) · 2.75 KB
/
Copy pathwebpack.config.js
File metadata and controls
114 lines (110 loc) · 2.75 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
110
111
112
113
114
// webpack.config.js
import path from 'path'
import { fileURLToPath } from 'url'
import HtmlWebpackPlugin from 'html-webpack-plugin'
import MiniCssExtractPlugin from 'mini-css-extract-plugin'
import CopyPlugin from 'copy-webpack-plugin'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.join(path.dirname(__filename), './')
const distPath = path.resolve(__dirname, 'dist')
console.log(distPath)
export default {
mode: 'development',
entry: './src/tools/nodeflow/editor.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
resolve: {
extensions: ['.js'],
alias: {
'@nodeflow': path.resolve(__dirname, 'src/tools/nodeflow/'),
'@src': path.resolve(__dirname, 'src/')
},
fallback: {
fs: false,
path: false,
util: false,
stream: false,
buffer: false,
crypto: false,
http: false,
https: false,
os: false,
url: false,
zlib: false,
assert: false,
querystring: false,
'rdf-utils-fs': false
}
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules\/(?!rdf-utils-fs)/, // Exclude node_modules except rdf-utils-fs
use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', {
targets: '> 0.25%, not dead',
modules: false,
useBuiltIns: 'usage',
corejs: 3
}]
]
}
}
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader']
},
{
test: /\.js$/,
include: /node_modules\/(rdf-utils-fs)/, // Only apply to rdf-utils-fs
resolve: {
fullySpecified: false
},
use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', {
targets: '> 0.25%, not dead',
modules: 'commonjs', // Force CommonJS for this module
useBuiltIns: 'usage',
corejs: 3
}]
]
}
}
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: './src/tools/nodeflow/editor.html',
filename: 'index.html'
}),
new MiniCssExtractPlugin({
filename: 'styles.css'
}),
new CopyPlugin({
patterns: [
{ from: 'src/apps/intro', to: 'samples' },
{ from: path.resolve(__dirname, 'src/tools/nodeflow/samples'), to: 'samples' },
{ from: 'src/apps/example-app', to: 'samples/example-app' }
]
})
],
devServer: {
static: {
directory: path.join(__dirname, 'dist')
},
hot: true,
port: 9000,
open: true
}
}