brick-engine-cli 1.0.3 → 1.0.5
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/package.json +1 -1
- package/templates/webpack.config.js +10 -7
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { fileURLToPath } from 'url';
|
|
3
|
-
import webpack from 'webpack';
|
|
4
3
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
5
4
|
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
6
5
|
import CopyWebpackPlugin from 'copy-webpack-plugin';
|
|
@@ -22,12 +21,19 @@ export default (env = {}, argv) => {
|
|
|
22
21
|
// In 'bundle' mode, we bundle ONLY the game class
|
|
23
22
|
// In 'standalone' mode, we load the engine with the user's game
|
|
24
23
|
entry: {
|
|
25
|
-
app: path.resolve(__dirname, 'src/bootstrap.ts'),
|
|
24
|
+
app: bundleMode === 'bundle' ? path.resolve(__dirname, 'src/index.ts') : path.resolve(__dirname, 'src/bootstrap.ts'),
|
|
26
25
|
},
|
|
27
26
|
output: {
|
|
28
27
|
filename: 'game.bundle.js',
|
|
29
28
|
path: path.resolve(__dirname, 'dist'),
|
|
30
29
|
clean: true,
|
|
30
|
+
...(bundleMode === 'bundle'
|
|
31
|
+
? {
|
|
32
|
+
library: 'BrickEngineGame',
|
|
33
|
+
libraryTarget: 'window',
|
|
34
|
+
libraryExport: 'default',
|
|
35
|
+
}
|
|
36
|
+
: {}),
|
|
31
37
|
},
|
|
32
38
|
devtool: isProduction ? false : 'source-map',
|
|
33
39
|
module: {
|
|
@@ -55,11 +61,6 @@ export default (env = {}, argv) => {
|
|
|
55
61
|
'brick-engine-js': 'BrickEngine',
|
|
56
62
|
},
|
|
57
63
|
plugins: [
|
|
58
|
-
new webpack.DefinePlugin({
|
|
59
|
-
'process.env.APP_MODE': JSON.stringify('client'),
|
|
60
|
-
'process.env.SUPABASE_URL': JSON.stringify(process.env.SUPABASE_URL || ''),
|
|
61
|
-
'process.env.SUPABASE_ANON_KEY': JSON.stringify(process.env.SUPABASE_ANON_KEY || ''),
|
|
62
|
-
}),
|
|
63
64
|
new MiniCssExtractPlugin({
|
|
64
65
|
filename: 'style.css',
|
|
65
66
|
}),
|
|
@@ -73,6 +74,8 @@ export default (env = {}, argv) => {
|
|
|
73
74
|
};
|
|
74
75
|
|
|
75
76
|
if (bundleMode === 'standalone') {
|
|
77
|
+
delete config.externals['brick-engine-js'];
|
|
78
|
+
|
|
76
79
|
// Plugins only for standalone mode
|
|
77
80
|
config.plugins.push(
|
|
78
81
|
new HtmlWebpackPlugin({
|