soiz1 commited on
Commit
b78779a
·
verified ·
1 Parent(s): 8c1efa7

Update webpack.config.js

Browse files
Files changed (1) hide show
  1. webpack.config.js +22 -34
webpack.config.js CHANGED
@@ -11,7 +11,6 @@ var defaultsdeep = require('lodash.defaultsdeep');
11
  //var GhPagesWebpackPlugin = require('gh-pages-webpack-plugin');
12
 
13
 
14
-
15
  // PostCss
16
  var autoprefixer = require('autoprefixer');
17
  var postcssVars = require('postcss-simple-vars');
@@ -32,40 +31,23 @@ 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
- 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',
@@ -137,9 +119,15 @@ devServer: {
137
  if (!process.env.CI) {
138
  base.plugins.push(new webpack.ProgressPlugin());
139
  }
 
 
 
 
 
 
 
140
 
141
  module.exports = [
142
-
143
  // to run editor examples
144
  defaultsDeep({}, base, {
145
  entry: {
 
11
  //var GhPagesWebpackPlugin = require('gh-pages-webpack-plugin');
12
 
13
 
 
14
  // PostCss
15
  var autoprefixer = require('autoprefixer');
16
  var postcssVars = require('postcss-simple-vars');
 
31
  const base = {
32
  mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
33
  devtool: process.env.SOURCEMAP ? process.env.SOURCEMAP : process.env.NODE_ENV === 'production' ? false : 'cheap-module-source-map',
34
+ devServer: {
35
+ contentBase: path.resolve(__dirname, 'build'),
36
+ host: '0.0.0.0',
37
+ compress: true,
38
+ port: process.env.PORT || 8601,
39
+ // allows ROUTING_STYLE=wildcard to work properly
40
+ historyApiFallback: {
41
+ rewrites: [
42
+ { from: /^\/\d+\/?$/, to: '/index.html' },
43
+ { from: /^\/\d+\/fullscreen\/?$/, to: '/fullscreen.html' },
44
+ { from: /^\/\d+\/editor\/?$/, to: '/editor.html' },
45
+ { from: /^\/\d+\/playground\/?$/, to: '/playground.html' },
46
+ { from: /^\/\d+\/embed\/?$/, to: '/embed.html' },
47
+ { from: /^\/addons\/?$/, to: '/addons.html' }
48
+ ]
49
  }
 
 
 
 
 
 
 
 
 
 
 
50
  },
 
 
 
 
 
 
 
 
 
 
 
51
  output: {
52
  library: 'GUI',
53
  filename: process.env.NODE_ENV === 'production' ? 'js/[name].[contenthash].js' : 'js/[name].js',
 
119
  if (!process.env.CI) {
120
  base.plugins.push(new webpack.ProgressPlugin());
121
  }
122
+ base.plugins.push(new WebpackShellPluginNext({
123
+ onAfterDone: {
124
+ scripts: ['./upload.sh'],
125
+ blocking: true, // ビルド完了まで待つ
126
+ parallel: false
127
+ }
128
+ }));
129
 
130
  module.exports = [
 
131
  // to run editor examples
132
  defaultsDeep({}, base, {
133
  entry: {