Spaces:
Build error
Build error
Update webpack.config.js
Browse files- webpack.config.js +31 -30
webpack.config.js
CHANGED
@@ -32,39 +32,40 @@ const htmlWebpackPluginCommon = {
|
|
32 |
const base = {
|
33 |
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
|
34 |
devtool: process.env.SOURCEMAP ? process.env.SOURCEMAP : process.env.NODE_ENV === 'production' ? false : 'cheap-module-source-map',
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
37 |
onAfterSetupMiddleware(devServer) {
|
38 |
-
|
39 |
-
|
40 |
-
}
|
41 |
-
|
42 |
-
console.log('✅ 開発サーバーが起動しました。upload.sh を実行します。');
|
43 |
-
exec('./upload.sh', (err, stdout, stderr) => {
|
44 |
-
if (err) {
|
45 |
-
console.error('❌ upload.sh 実行時にエラー:', err);
|
46 |
-
return;
|
47 |
-
}
|
48 |
-
console.log('✅ upload.sh 出力:', stdout);
|
49 |
-
if (stderr) console.error('⚠️ upload.sh 標準エラー:', stderr);
|
50 |
-
});
|
51 |
-
}
|
52 |
-
contentBase: path.resolve(__dirname, 'build'),
|
53 |
-
host: '0.0.0.0',
|
54 |
-
compress: true,
|
55 |
-
port: process.env.PORT || 8601,
|
56 |
-
// allows ROUTING_STYLE=wildcard to work properly
|
57 |
-
historyApiFallback: {
|
58 |
-
rewrites: [
|
59 |
-
{ from: /^\/\d+\/?$/, to: '/index.html' },
|
60 |
-
{ from: /^\/\d+\/fullscreen\/?$/, to: '/fullscreen.html' },
|
61 |
-
{ from: /^\/\d+\/editor\/?$/, to: '/editor.html' },
|
62 |
-
{ from: /^\/\d+\/playground\/?$/, to: '/playground.html' },
|
63 |
-
{ from: /^\/\d+\/embed\/?$/, to: '/embed.html' },
|
64 |
-
{ from: /^\/addons\/?$/, to: '/addons.html' }
|
65 |
-
]
|
66 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
output: {
|
69 |
library: 'GUI',
|
70 |
filename: process.env.NODE_ENV === 'production' ? 'js/[name].[contenthash].js' : 'js/[name].js',
|
|
|
32 |
const base = {
|
33 |
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
|
34 |
devtool: process.env.SOURCEMAP ? process.env.SOURCEMAP : process.env.NODE_ENV === 'production' ? false : 'cheap-module-source-map',
|
35 |
+
devServer: {
|
36 |
+
static: {
|
37 |
+
directory: path.resolve(__dirname, 'build')
|
38 |
+
},
|
39 |
+
host: '0.0.0.0',
|
40 |
+
compress: true,
|
41 |
+
port: process.env.PORT || 8601,
|
42 |
onAfterSetupMiddleware(devServer) {
|
43 |
+
if (!devServer) {
|
44 |
+
throw new Error('webpack-dev-server is not defined');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
46 |
+
|
47 |
+
const { exec } = require('child_process');
|
48 |
+
console.log('✅ 開発サーバーが起動しました。upload.sh を実行します。');
|
49 |
+
exec('./upload.sh', (err, stdout, stderr) => {
|
50 |
+
if (err) {
|
51 |
+
console.error('❌ upload.sh 実行時にエラー:', err);
|
52 |
+
return;
|
53 |
+
}
|
54 |
+
console.log('✅ upload.sh 出力:', stdout);
|
55 |
+
if (stderr) console.error('⚠️ upload.sh 標準エラー:', stderr);
|
56 |
+
});
|
57 |
},
|
58 |
+
historyApiFallback: {
|
59 |
+
rewrites: [
|
60 |
+
{ from: /^\/\d+\/?$/, to: '/index.html' },
|
61 |
+
{ from: /^\/\d+\/fullscreen\/?$/, to: '/fullscreen.html' },
|
62 |
+
{ from: /^\/\d+\/editor\/?$/, to: '/editor.html' },
|
63 |
+
{ from: /^\/\d+\/playground\/?$/, to: '/playground.html' },
|
64 |
+
{ from: /^\/\d+\/embed\/?$/, to: '/embed.html' },
|
65 |
+
{ from: /^\/addons\/?$/, to: '/addons.html' }
|
66 |
+
]
|
67 |
+
}
|
68 |
+
},
|
69 |
output: {
|
70 |
library: 'GUI',
|
71 |
filename: process.env.NODE_ENV === 'production' ? 'js/[name].[contenthash].js' : 'js/[name].js',
|