@vixoniccom/module-packager 2.13.0-dev.0 → 2.13.0-test.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +1 -0
- package/dist/webpack.config.js +53 -61
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -68,6 +68,7 @@ function createElectronArgs(mode) {
|
|
|
68
68
|
];
|
|
69
69
|
}
|
|
70
70
|
function spawnElectronProcess(mode) {
|
|
71
|
+
console.log('env:', process.env.AQI_TOKEN);
|
|
71
72
|
const args = createElectronArgs(mode);
|
|
72
73
|
const nodeEnv = mode === 'run' ? 'production' : 'development';
|
|
73
74
|
const child = spawn(npxPath, ['electron', ...args], {
|
package/dist/webpack.config.js
CHANGED
|
@@ -13,7 +13,9 @@ export default (env = {}, argv = {}) => {
|
|
|
13
13
|
port: env.port ?? 8080,
|
|
14
14
|
mode: argv.mode ?? 'production',
|
|
15
15
|
};
|
|
16
|
-
const isDev = options.mode === 'development' ||
|
|
16
|
+
const isDev = options.mode === 'development' ||
|
|
17
|
+
argv.watch === true ||
|
|
18
|
+
process.env.NODE_ENV === 'development';
|
|
17
19
|
const buildPath = path.resolve(options.build);
|
|
18
20
|
const controllerHtmlPath = path.resolve(options.src, 'index.html');
|
|
19
21
|
const controllerStaticPath = path.resolve(path.dirname(controllerHtmlPath), '../static');
|
|
@@ -22,22 +24,20 @@ export default (env = {}, argv = {}) => {
|
|
|
22
24
|
return {
|
|
23
25
|
mode: isDev ? 'development' : 'production',
|
|
24
26
|
target: options.target ?? 'electron-renderer',
|
|
25
|
-
entry: isDev
|
|
26
|
-
?
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
]
|
|
31
|
-
: path.resolve(options.src, 'main.ts'),
|
|
27
|
+
entry: isDev ? [
|
|
28
|
+
`webpack-dev-server/client?http://localhost:${options.port}/`,
|
|
29
|
+
'webpack/hot/dev-server',
|
|
30
|
+
path.resolve(options.src, 'main.ts')
|
|
31
|
+
] : path.resolve(options.src, 'main.ts'),
|
|
32
32
|
output: {
|
|
33
33
|
path: buildPath,
|
|
34
34
|
filename: '[name].js',
|
|
35
|
-
publicPath: isDev ? '/' : './'
|
|
35
|
+
publicPath: isDev ? '/' : './'
|
|
36
36
|
},
|
|
37
37
|
performance: {
|
|
38
38
|
maxAssetSize: 2000000, //2MB
|
|
39
39
|
maxEntrypointSize: 2000000,
|
|
40
|
-
hints: isDev ? false : 'warning'
|
|
40
|
+
hints: isDev ? false : 'warning'
|
|
41
41
|
},
|
|
42
42
|
externals: {
|
|
43
43
|
electron: 'commonjs electron',
|
|
@@ -46,7 +46,7 @@ export default (env = {}, argv = {}) => {
|
|
|
46
46
|
'terser-webpack-plugin': 'commonjs terser-webpack-plugin',
|
|
47
47
|
esbuild: 'commonjs esbuild',
|
|
48
48
|
'@swc/core': 'commonjs @swc/core',
|
|
49
|
-
'@swc/wasm': 'commonjs @swc/wasm'
|
|
49
|
+
'@swc/wasm': 'commonjs @swc/wasm'
|
|
50
50
|
},
|
|
51
51
|
resolve: {
|
|
52
52
|
extensions: ['.tsx', '.ts', '.js', '.jsx', '.mjs'],
|
|
@@ -54,9 +54,9 @@ export default (env = {}, argv = {}) => {
|
|
|
54
54
|
fullySpecified: false,
|
|
55
55
|
fallback: {
|
|
56
56
|
process: require.resolve('process/browser.js'),
|
|
57
|
-
global: require.resolve('global')
|
|
57
|
+
global: require.resolve('global')
|
|
58
58
|
},
|
|
59
|
-
modules: ['node_modules', 'src', 'static']
|
|
59
|
+
modules: ['node_modules', 'src', 'static']
|
|
60
60
|
},
|
|
61
61
|
module: {
|
|
62
62
|
rules: [
|
|
@@ -66,25 +66,25 @@ export default (env = {}, argv = {}) => {
|
|
|
66
66
|
use: {
|
|
67
67
|
loader: 'ts-loader',
|
|
68
68
|
options: {
|
|
69
|
-
transpileOnly: true
|
|
70
|
-
}
|
|
71
|
-
}
|
|
69
|
+
transpileOnly: true
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
test: /\.s[ac]ss$/,
|
|
75
|
-
use: ['style-loader', 'css-loader', 'sass-loader']
|
|
75
|
+
use: ['style-loader', 'css-loader', 'sass-loader']
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
test: /\.css$/,
|
|
79
79
|
use: ['style-loader', 'css-loader'],
|
|
80
|
-
exclude: /node_modules
|
|
80
|
+
exclude: /node_modules/
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
83
|
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|mp4)$/,
|
|
84
84
|
type: 'asset/resource',
|
|
85
85
|
generator: {
|
|
86
|
-
filename: '[name][ext]'
|
|
87
|
-
}
|
|
86
|
+
filename: '[name][ext]'
|
|
87
|
+
}
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
90
|
test: /\.html$/,
|
|
@@ -92,38 +92,32 @@ export default (env = {}, argv = {}) => {
|
|
|
92
92
|
loader: 'html-loader',
|
|
93
93
|
options: {
|
|
94
94
|
sources: false,
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
]
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
99
|
},
|
|
100
100
|
plugins: [
|
|
101
101
|
new webpack.DefinePlugin({
|
|
102
|
-
global: 'globalThis'
|
|
103
|
-
// env variables
|
|
104
|
-
'process.env.AQI_TOKEN': JSON.stringify(process.env.AQI_TOKEN || ''),
|
|
105
|
-
'process.env.PTS_CLIENT_ID': JSON.stringify(process.env.PTS_CLIENT_ID || ''),
|
|
106
|
-
'process.env.PTS_CLIENT_SECRET': JSON.stringify(process.env.PTS_CLIENT_SECRET || ''),
|
|
107
|
-
'process.env.FS_API_KEY': JSON.stringify(process.env.FS_API_KEY || ''),
|
|
108
|
-
'process.env.FS_API_HOST': JSON.stringify(process.env.FS_API_HOST || ''),
|
|
102
|
+
global: 'globalThis'
|
|
109
103
|
}),
|
|
110
104
|
new webpack.ProvidePlugin({
|
|
111
|
-
process: 'process/browser.js'
|
|
105
|
+
process: 'process/browser.js'
|
|
112
106
|
}),
|
|
113
107
|
new CleanWebpackPlugin(),
|
|
114
108
|
new HtmlWebpackPlugin({
|
|
115
109
|
template: controllerHtmlPath,
|
|
116
110
|
filename: 'index.html',
|
|
117
111
|
inject: 'body',
|
|
118
|
-
chunks: ['main']
|
|
112
|
+
chunks: ['main']
|
|
119
113
|
}),
|
|
120
114
|
new CopyWebpackPlugin({
|
|
121
115
|
patterns: [
|
|
122
116
|
{ from: controllerStaticPath, to: 'static', noErrorOnMissing: true },
|
|
123
117
|
{ from: controllerFontsPath, to: 'fonts', noErrorOnMissing: true },
|
|
124
|
-
{ from: controllerTestPath, to: 'test', noErrorOnMissing: true }
|
|
125
|
-
]
|
|
126
|
-
})
|
|
118
|
+
{ from: controllerTestPath, to: 'test', noErrorOnMissing: true }
|
|
119
|
+
]
|
|
120
|
+
})
|
|
127
121
|
],
|
|
128
122
|
optimization: {
|
|
129
123
|
minimize: !isDev,
|
|
@@ -134,33 +128,31 @@ export default (env = {}, argv = {}) => {
|
|
|
134
128
|
ecma: 2020,
|
|
135
129
|
compress: true,
|
|
136
130
|
mangle: true,
|
|
137
|
-
format: { comments: false }
|
|
138
|
-
}
|
|
139
|
-
})
|
|
140
|
-
]
|
|
131
|
+
format: { comments: false }
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
]
|
|
141
135
|
},
|
|
142
136
|
devtool: isDev ? 'source-map' : false,
|
|
143
|
-
devServer: isDev
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
writeToDisk: false,
|
|
162
|
-
},
|
|
137
|
+
devServer: isDev ? {
|
|
138
|
+
static: [
|
|
139
|
+
{
|
|
140
|
+
directory: path.resolve(options.src, 'test'),
|
|
141
|
+
publicPath: '/test',
|
|
142
|
+
watch: true,
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
open: false,
|
|
146
|
+
client: {
|
|
147
|
+
overlay: true
|
|
148
|
+
},
|
|
149
|
+
port: options.port || 8080,
|
|
150
|
+
hot: true,
|
|
151
|
+
historyApiFallback: true,
|
|
152
|
+
devMiddleware: {
|
|
153
|
+
publicPath: '/',
|
|
154
|
+
writeToDisk: false
|
|
163
155
|
}
|
|
164
|
-
|
|
156
|
+
} : undefined
|
|
165
157
|
};
|
|
166
158
|
};
|