@nitro-web/webpack 0.0.26 → 0.0.27
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/webpack.config.js +15 -3
package/package.json
CHANGED
package/webpack.config.js
CHANGED
|
@@ -19,7 +19,6 @@ import { createRequire } from 'module'
|
|
|
19
19
|
import { getDirectories } from 'nitro-web/util'
|
|
20
20
|
|
|
21
21
|
const _require = createRequire(import.meta.url)
|
|
22
|
-
const pick = (object, list) => list.reduce((o, e) => ((o[e] = object[e]), o), {})
|
|
23
22
|
const isBuild = process.env.NODE_ENV == 'production'
|
|
24
23
|
const nitroVersion = _require('./package.json').version
|
|
25
24
|
|
|
@@ -274,9 +273,11 @@ export const getConfig = (config) => {
|
|
|
274
273
|
],
|
|
275
274
|
}),
|
|
276
275
|
new webpack.DefinePlugin({
|
|
277
|
-
ISDEMO: !!process.env.isDemo,
|
|
278
276
|
INJECTED_CONFIG: JSON.stringify({
|
|
279
|
-
...
|
|
277
|
+
...config.client,
|
|
278
|
+
isDemo: !!process.env.isDemo,
|
|
279
|
+
isStatic: !!process.env.isStatic,
|
|
280
|
+
jwtName: 'nitro-jwt' + (isBuild ? '' : '-' + formatSlug(config.name)),
|
|
280
281
|
version: process.env.isDemo ? nitroVersion : config.version,
|
|
281
282
|
}),
|
|
282
283
|
}),
|
|
@@ -357,4 +358,15 @@ function getPublicPath(env, homepage, publicPath) {
|
|
|
357
358
|
} else {
|
|
358
359
|
return '/'
|
|
359
360
|
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
function formatSlug (string) {
|
|
364
|
+
return string
|
|
365
|
+
.toString()
|
|
366
|
+
.toLowerCase()
|
|
367
|
+
.replace(/^[^a-zA-Z]+/, '') // Allow only letters at start.
|
|
368
|
+
.replace(/\s+/g, '-') // Spaces to -
|
|
369
|
+
.replace(/[^a-zA-Z0-9-_]+/g, '') // Remove bad characters.
|
|
370
|
+
.replace(/-+/g, '-') // Replace multiple - with single -
|
|
371
|
+
.replace(/-+$/, '') // Remove trailing -
|
|
360
372
|
}
|