@startupjs/bundler 0.39.11 → 0.40.6
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 +24 -29
- package/webpack.server.config.js +9 -7
- package/webpack.web.config.js +52 -23
- package/vite.config.js +0 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startupjs/bundler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.6",
|
|
4
4
|
"description": "Opinionated scripts and configs to develop a react-native-web project",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -16,43 +16,38 @@
|
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@babel/polyfill": "^7.8.0",
|
|
19
|
-
"@mdx-js/loader": "^1.
|
|
20
|
-
"@mdx-js/mdx": "^1.
|
|
21
|
-
"@pmmmwh/react-refresh-webpack-plugin": "^0.
|
|
19
|
+
"@mdx-js/loader": "^1.6.22",
|
|
20
|
+
"@mdx-js/mdx": "^1.6.22",
|
|
21
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.1",
|
|
22
22
|
"@startupjs/css-to-react-native-transform": "^1.9.0-1",
|
|
23
|
-
"@startupjs/plugin": "^0.
|
|
24
|
-
"@svgr/webpack": "5.
|
|
25
|
-
"assets-webpack-plugin": "^
|
|
26
|
-
"autoprefixer": "^
|
|
27
|
-
"babel-loader": "^8.
|
|
28
|
-
"babel-preset-startupjs": "^0.
|
|
29
|
-
"css-loader": "^
|
|
30
|
-
"
|
|
31
|
-
"
|
|
23
|
+
"@startupjs/plugin": "^0.40.0",
|
|
24
|
+
"@svgr/webpack": "~5.5.0",
|
|
25
|
+
"assets-webpack-plugin": "^7.1.1",
|
|
26
|
+
"autoprefixer": "^10.4.0",
|
|
27
|
+
"babel-loader": "^8.2.3",
|
|
28
|
+
"babel-preset-startupjs": "^0.40.6",
|
|
29
|
+
"css-loader": "^6.5.0",
|
|
30
|
+
"css-minimizer-webpack-plugin": "^3.1.1",
|
|
31
|
+
"file-loader": "^6.2.0",
|
|
32
32
|
"generic-names": "^1.0.3",
|
|
33
33
|
"lodash": "^4.17.20",
|
|
34
34
|
"metro-config": "*",
|
|
35
|
-
"mini-css-extract-plugin": "^
|
|
35
|
+
"mini-css-extract-plugin": "^2.4.3",
|
|
36
36
|
"moment": "^2.0.0",
|
|
37
37
|
"moment-locales-webpack-plugin": "^1.0.7",
|
|
38
|
-
"
|
|
39
|
-
"postcss-loader": "^
|
|
40
|
-
"
|
|
38
|
+
"postcss": "^8.3.11",
|
|
39
|
+
"postcss-loader": "^6.2.0",
|
|
40
|
+
"process": "^0.11.10",
|
|
41
41
|
"react-native-svg-transformer": "0.14.3",
|
|
42
|
-
"
|
|
42
|
+
"react-refresh": "^0.10.0",
|
|
43
|
+
"style-loader": "^3.3.1",
|
|
43
44
|
"stylus": "0.54.7",
|
|
44
|
-
"stylus-loader": "^
|
|
45
|
-
"terser-webpack-plugin": "^
|
|
46
|
-
"webpack-node-externals": "^
|
|
45
|
+
"stylus-loader": "^6.2.0",
|
|
46
|
+
"terser-webpack-plugin": "^5.2.4",
|
|
47
|
+
"webpack-node-externals": "^3.0.0"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
49
|
-
"react-native-svg": ">= 12.1.0"
|
|
50
|
-
"vite-plugin-startupjs": "*"
|
|
50
|
+
"react-native-svg": ">= 12.1.0"
|
|
51
51
|
},
|
|
52
|
-
"
|
|
53
|
-
"vite-plugin-startupjs": {
|
|
54
|
-
"optional": true
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
"gitHead": "00236f4885a5d565dc5212490243313cf0f11519"
|
|
52
|
+
"gitHead": "a2c393f4d922498374151663530fb689c8d9c4d6"
|
|
58
53
|
}
|
package/webpack.server.config.js
CHANGED
|
@@ -2,7 +2,6 @@ const { getPluginConfigs } = require('@startupjs/plugin/manager.cjs')
|
|
|
2
2
|
const pickBy = require('lodash/pickBy')
|
|
3
3
|
const path = require('path')
|
|
4
4
|
const nodeExternals = require('webpack-node-externals')
|
|
5
|
-
const ProgressBarPlugin = require('progress-bar-webpack-plugin')
|
|
6
5
|
const PROD = !process.env.WEBPACK_DEV
|
|
7
6
|
const BUILD_DIR = '/build/'
|
|
8
7
|
const BUILD_PATH = path.join(process.cwd(), BUILD_DIR)
|
|
@@ -33,10 +32,10 @@ module.exports = function getConfig (env, {
|
|
|
33
32
|
return new RegExp('^' + moduleName + '($|/)')
|
|
34
33
|
})
|
|
35
34
|
return pickBy({
|
|
36
|
-
|
|
37
|
-
externals: [nodeExternals({
|
|
35
|
+
externalsPresets: { node: true }, // in order to ignore built-in modules like path, fs, etc.
|
|
36
|
+
externals: [nodeExternals({ // in order to ignore all modules in node_modules folder
|
|
38
37
|
modulesDir,
|
|
39
|
-
|
|
38
|
+
allowlist: forceCompileModules
|
|
40
39
|
})], // in order to ignore all modules in node_modules folder
|
|
41
40
|
mode: PROD ? 'production' : 'development',
|
|
42
41
|
devtool: 'source-map',
|
|
@@ -44,9 +43,9 @@ module.exports = function getConfig (env, {
|
|
|
44
43
|
server: ['@babel/polyfill', './server.js']
|
|
45
44
|
},
|
|
46
45
|
plugins: [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
// TODO: Reenable progress plugin if the following issue gets fixed:
|
|
47
|
+
// https://github.com/open-cli-tools/concurrently/issues/85
|
|
48
|
+
// new webpack.ProgressPlugin()
|
|
50
49
|
],
|
|
51
50
|
output: {
|
|
52
51
|
path: BUILD_PATH,
|
|
@@ -56,6 +55,9 @@ module.exports = function getConfig (env, {
|
|
|
56
55
|
rules: [
|
|
57
56
|
{
|
|
58
57
|
test: /\.[cm]?[jt]sx?$/,
|
|
58
|
+
resolve: {
|
|
59
|
+
fullySpecified: false
|
|
60
|
+
},
|
|
59
61
|
loader: 'babel-loader'
|
|
60
62
|
}
|
|
61
63
|
]
|
package/webpack.web.config.js
CHANGED
|
@@ -4,15 +4,12 @@ const pick = require('lodash/pick')
|
|
|
4
4
|
const fs = require('fs')
|
|
5
5
|
const path = require('path')
|
|
6
6
|
const AssetsPlugin = require('assets-webpack-plugin')
|
|
7
|
-
const ProgressBarPlugin = require('progress-bar-webpack-plugin')
|
|
8
7
|
const MomentLocalesPlugin = require('moment-locales-webpack-plugin')
|
|
9
|
-
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin')
|
|
10
8
|
const TerserPlugin = require('terser-webpack-plugin')
|
|
11
9
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
|
12
|
-
const
|
|
10
|
+
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
|
|
13
11
|
const { LOCAL_IDENT_NAME } = require('babel-preset-startupjs/constants')
|
|
14
12
|
const autoprefixer = require('autoprefixer')
|
|
15
|
-
const VERBOSE = process.env.VERBOSE
|
|
16
13
|
const DEV_PORT = ~~process.env.DEV_PORT || 3010
|
|
17
14
|
const PROD = !process.env.WEBPACK_DEV
|
|
18
15
|
const STYLES_PATH = path.join(process.cwd(), '/styles/index.styl')
|
|
@@ -67,14 +64,30 @@ module.exports = function getConfig (env, {
|
|
|
67
64
|
entry: {
|
|
68
65
|
[BUNDLE_NAME]: DEFAULT_ENTRIES.concat(['./index.web.js'])
|
|
69
66
|
},
|
|
67
|
+
cache: !PROD && {
|
|
68
|
+
type: 'filesystem',
|
|
69
|
+
memoryCacheUnaffected: true,
|
|
70
|
+
compression: 'brotli'
|
|
71
|
+
},
|
|
72
|
+
snapshot: !PROD && {
|
|
73
|
+
// By default it's ['./node_modules'] which prevents us from updating
|
|
74
|
+
// node_modules directly. We do it pretty often though, so that's why
|
|
75
|
+
// we override managedPaths to an empty array here.
|
|
76
|
+
//
|
|
77
|
+
// TODO: Think whether it makes more sense to have node_modules
|
|
78
|
+
// be ignored by default but provide an additional option
|
|
79
|
+
// when you don't want to ignore them.
|
|
80
|
+
managedPaths: []
|
|
81
|
+
},
|
|
82
|
+
experiments: !PROD && {
|
|
83
|
+
cacheUnaffected: true
|
|
84
|
+
},
|
|
70
85
|
optimization: (PROD || ASYNC) && pickBy({
|
|
71
86
|
minimizer: PROD && [
|
|
72
87
|
new TerserPlugin({
|
|
73
|
-
|
|
74
|
-
parallel: true,
|
|
75
|
-
sourceMap: false // set to true if you want JS source maps
|
|
88
|
+
parallel: true
|
|
76
89
|
}),
|
|
77
|
-
new
|
|
90
|
+
new CssMinimizerPlugin()
|
|
78
91
|
],
|
|
79
92
|
splitChunks: ASYNC && {
|
|
80
93
|
maxInitialRequests: Infinity,
|
|
@@ -142,7 +155,9 @@ module.exports = function getConfig (env, {
|
|
|
142
155
|
}
|
|
143
156
|
}, Boolean),
|
|
144
157
|
plugins: [
|
|
145
|
-
|
|
158
|
+
// TODO: Reenable progress plugin if the following issue gets fixed:
|
|
159
|
+
// https://github.com/open-cli-tools/concurrently/issues/85
|
|
160
|
+
// new webpack.ProgressPlugin(),
|
|
146
161
|
new MomentLocalesPlugin(), // strip all locales except 'en'
|
|
147
162
|
!PROD && new ReactRefreshWebpackPlugin({ forceEnable: true, overlay: { sockPort: DEV_PORT } }),
|
|
148
163
|
PROD && new MiniCssExtractPlugin({
|
|
@@ -154,11 +169,12 @@ module.exports = function getConfig (env, {
|
|
|
154
169
|
fullPath: false,
|
|
155
170
|
path: BUILD_PATH
|
|
156
171
|
}),
|
|
157
|
-
new ProgressBarPlugin({
|
|
158
|
-
format: '\u001b[1m\u001b[32m:percent\u001b[0m (:elapsed seconds)'
|
|
159
|
-
}),
|
|
160
172
|
new webpack.DefinePlugin({
|
|
161
|
-
__DEV__: !PROD
|
|
173
|
+
__DEV__: !PROD,
|
|
174
|
+
global: 'window'
|
|
175
|
+
}),
|
|
176
|
+
new webpack.ProvidePlugin({
|
|
177
|
+
process: 'process/browser.js'
|
|
162
178
|
})
|
|
163
179
|
].filter(Boolean),
|
|
164
180
|
output: {
|
|
@@ -170,6 +186,9 @@ module.exports = function getConfig (env, {
|
|
|
170
186
|
rules: [
|
|
171
187
|
{
|
|
172
188
|
test: getJsxRule().test,
|
|
189
|
+
resolve: {
|
|
190
|
+
fullySpecified: false
|
|
191
|
+
},
|
|
173
192
|
exclude: /node_modules/,
|
|
174
193
|
use: [
|
|
175
194
|
pick(getJsxRule(), ['loader', 'options']),
|
|
@@ -180,6 +199,9 @@ module.exports = function getConfig (env, {
|
|
|
180
199
|
},
|
|
181
200
|
{
|
|
182
201
|
test: getJsxRule().test,
|
|
202
|
+
resolve: {
|
|
203
|
+
fullySpecified: false
|
|
204
|
+
},
|
|
183
205
|
include: new RegExp(`node_modules/(?:react-native-(?!web)|${forceCompileModules.join('|')})`),
|
|
184
206
|
use: [
|
|
185
207
|
pick(getJsxRule(), ['loader', 'options']),
|
|
@@ -228,8 +250,9 @@ module.exports = function getConfig (env, {
|
|
|
228
250
|
{
|
|
229
251
|
loader: 'css-loader',
|
|
230
252
|
options: {
|
|
231
|
-
modules:
|
|
232
|
-
|
|
253
|
+
modules: {
|
|
254
|
+
localIdentName: LOCAL_IDENT_NAME
|
|
255
|
+
}
|
|
233
256
|
}
|
|
234
257
|
},
|
|
235
258
|
{
|
|
@@ -241,10 +264,12 @@ module.exports = function getConfig (env, {
|
|
|
241
264
|
{
|
|
242
265
|
loader: 'stylus-loader',
|
|
243
266
|
options: {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
267
|
+
stylusOptions: {
|
|
268
|
+
use: [],
|
|
269
|
+
import: fs.existsSync(STYLES_PATH) ? [STYLES_PATH] : [],
|
|
270
|
+
define: {
|
|
271
|
+
__WEB__: true
|
|
272
|
+
}
|
|
248
273
|
}
|
|
249
274
|
}
|
|
250
275
|
}
|
|
@@ -271,8 +296,9 @@ module.exports = function getConfig (env, {
|
|
|
271
296
|
{
|
|
272
297
|
loader: 'css-loader',
|
|
273
298
|
options: {
|
|
274
|
-
modules:
|
|
275
|
-
|
|
299
|
+
modules: {
|
|
300
|
+
localIdentName: LOCAL_IDENT_NAME
|
|
301
|
+
}
|
|
276
302
|
}
|
|
277
303
|
}
|
|
278
304
|
] : [
|
|
@@ -300,7 +326,8 @@ module.exports = function getConfig (env, {
|
|
|
300
326
|
resolve: {
|
|
301
327
|
alias: {
|
|
302
328
|
...DEFAULT_ALIAS,
|
|
303
|
-
...alias
|
|
329
|
+
...alias,
|
|
330
|
+
process: 'process/browser.js'
|
|
304
331
|
},
|
|
305
332
|
extensions: EXTENSIONS,
|
|
306
333
|
mainFields: ['jsnext:main', 'browser', 'main']
|
|
@@ -312,7 +339,9 @@ module.exports = function getConfig (env, {
|
|
|
312
339
|
headers: {
|
|
313
340
|
'Access-Control-Allow-Origin': '*'
|
|
314
341
|
},
|
|
315
|
-
|
|
342
|
+
devMiddleware: {
|
|
343
|
+
publicPath: '/build/client/'
|
|
344
|
+
}
|
|
316
345
|
}
|
|
317
346
|
}, Boolean)
|
|
318
347
|
}
|
package/vite.config.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
const startupjsPlugin = require('vite-plugin-startupjs')
|
|
3
|
-
const reactPlugin = require('vite-plugin-startupjs/react')
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @type { import('vite').UserConfig }
|
|
7
|
-
*/
|
|
8
|
-
const config = {
|
|
9
|
-
jsx: 'react',
|
|
10
|
-
https: true,
|
|
11
|
-
plugins: [startupjsPlugin, reactPlugin],
|
|
12
|
-
alias: {},
|
|
13
|
-
optimizeDeps: {
|
|
14
|
-
include: [
|
|
15
|
-
...startupjsPlugin.optimizeDeps.include
|
|
16
|
-
],
|
|
17
|
-
exclude: [
|
|
18
|
-
...startupjsPlugin.optimizeDeps.exclude
|
|
19
|
-
],
|
|
20
|
-
link: [
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
module.exports = config
|