@@ -6,15 +6,17 @@ import MiniCssExtractPlugin from 'mini-css-extract-plugin';
6
6
import MonacoWebpackPlugin from 'monaco-editor-webpack-plugin' ;
7
7
import VueLoader from 'vue-loader' ;
8
8
import EsBuildLoader from 'esbuild-loader' ;
9
- import { resolve , parse , dirname } from 'path' ;
9
+ import { parse , dirname } from 'path' ;
10
10
import webpack from 'webpack' ;
11
11
import { fileURLToPath } from 'url' ;
12
12
13
13
const { VueLoaderPlugin} = VueLoader ;
14
14
const { ESBuildMinifyPlugin} = EsBuildLoader ;
15
15
const { SourceMapDevToolPlugin} = webpack ;
16
- const __dirname = dirname ( fileURLToPath ( import . meta. url ) ) ;
17
- const glob = ( pattern ) => fastGlob . sync ( pattern , { cwd : __dirname , absolute : true } ) ;
16
+ const glob = ( pattern ) => fastGlob . sync ( pattern , {
17
+ cwd : dirname ( fileURLToPath ( new URL ( import . meta. url ) ) ) ,
18
+ absolute : true ,
19
+ } ) ;
18
20
19
21
const themes = { } ;
20
22
for ( const path of glob ( 'web_src/less/themes/*.less' ) ) {
@@ -43,29 +45,29 @@ export default {
43
45
mode : isProduction ? 'production' : 'development' ,
44
46
entry : {
45
47
index : [
46
- resolve ( __dirname , 'web_src/js/jquery.js' ) ,
47
- resolve ( __dirname , 'web_src/fomantic/build/semantic.js' ) ,
48
- resolve ( __dirname , 'web_src/js/index.js' ) ,
49
- resolve ( __dirname , 'node_modules/easymde/dist/easymde.min.css' ) ,
50
- resolve ( __dirname , 'web_src/fomantic/build/semantic.css' ) ,
51
- resolve ( __dirname , 'web_src/less/misc.css' ) ,
52
- resolve ( __dirname , 'web_src/less/index.less' ) ,
48
+ fileURLToPath ( new URL ( 'web_src/js/jquery.js' , import . meta . url ) ) ,
49
+ fileURLToPath ( new URL ( 'web_src/fomantic/build/semantic.js' , import . meta . url ) ) ,
50
+ fileURLToPath ( new URL ( 'web_src/js/index.js' , import . meta . url ) ) ,
51
+ fileURLToPath ( new URL ( 'node_modules/easymde/dist/easymde.min.css' , import . meta . url ) ) ,
52
+ fileURLToPath ( new URL ( 'web_src/fomantic/build/semantic.css' , import . meta . url ) ) ,
53
+ fileURLToPath ( new URL ( 'web_src/less/misc.css' , import . meta . url ) ) ,
54
+ fileURLToPath ( new URL ( 'web_src/less/index.less' , import . meta . url ) ) ,
53
55
] ,
54
56
swagger : [
55
- resolve ( __dirname , 'web_src/js/standalone/swagger.js' ) ,
56
- resolve ( __dirname , 'web_src/less/standalone/swagger.less' ) ,
57
+ fileURLToPath ( new URL ( 'web_src/js/standalone/swagger.js' , import . meta . url ) ) ,
58
+ fileURLToPath ( new URL ( 'web_src/less/standalone/swagger.less' , import . meta . url ) ) ,
57
59
] ,
58
60
serviceworker : [
59
- resolve ( __dirname , 'web_src/js/serviceworker.js' ) ,
61
+ fileURLToPath ( new URL ( 'web_src/js/serviceworker.js' , import . meta . url ) ) ,
60
62
] ,
61
63
'eventsource.sharedworker' : [
62
- resolve ( __dirname , 'web_src/js/features/eventsource.sharedworker.js' ) ,
64
+ fileURLToPath ( new URL ( 'web_src/js/features/eventsource.sharedworker.js' , import . meta . url ) ) ,
63
65
] ,
64
66
...themes ,
65
67
} ,
66
68
devtool : false ,
67
69
output : {
68
- path : resolve ( __dirname , 'public' ) ,
70
+ path : fileURLToPath ( new URL ( 'public' , import . meta . url ) ) ,
69
71
filename : ( { chunk} ) => {
70
72
// serviceworker can only manage assets below it's script's directory so
71
73
// we have to put it in / instead of /js/
@@ -165,7 +167,7 @@ export default {
165
167
} ,
166
168
{
167
169
test : / \. s v g $ / ,
168
- include : resolve ( __dirname , 'public/img/svg' ) ,
170
+ include : fileURLToPath ( new URL ( 'public/img/svg' , import . meta . url ) ) ,
169
171
type : 'asset/source' ,
170
172
} ,
171
173
{
0 commit comments