@s-ui/bundler 9.67.0 → 9.68.0
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/README.md +45 -0
- package/package.json +5 -4
- package/shared/svg-spritemap.js +12 -0
- package/webpack.config.client.dev.js +3 -1
- package/webpack.config.prod.js +3 -1
package/README.md
CHANGED
|
@@ -227,6 +227,51 @@ There are two ways to activate the statics cache option:
|
|
|
227
227
|
|
|
228
228
|
> Statics will be cached but no offline page will be activated
|
|
229
229
|
|
|
230
|
+
### SVG Spritemaps
|
|
231
|
+
|
|
232
|
+
Generate SVG spritemaps by using [svg-spritemap-webpack-plugin](https://github.com/cascornelissen/svg-spritemap-webpack-plugin) as follows:
|
|
233
|
+
|
|
234
|
+
```json
|
|
235
|
+
{
|
|
236
|
+
"sui-bundler": {
|
|
237
|
+
"spritemaps": [
|
|
238
|
+
{
|
|
239
|
+
"path": ["icons/src/fotocasa/**/*.svg"],
|
|
240
|
+
"options": {
|
|
241
|
+
"output": {
|
|
242
|
+
"filename": "fotocasa.[contenthash].svg",
|
|
243
|
+
"chunk": {
|
|
244
|
+
"name": "fotocasa"
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
"sprite": {
|
|
248
|
+
"generate": {
|
|
249
|
+
"title": false
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"path": ["icons/src/habitaclia/**/*.svg"],
|
|
256
|
+
"options": {
|
|
257
|
+
"output": {
|
|
258
|
+
"filename": "habitaclia.[contenthash].svg",
|
|
259
|
+
"chunk": {
|
|
260
|
+
"name": "habitaclia"
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
"sprite": {
|
|
264
|
+
"generate": {
|
|
265
|
+
"title": false
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
]
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
230
275
|
## Externals Manifest
|
|
231
276
|
|
|
232
277
|
If your are using an external CDN to store statics assets that are now managed by Webpack, like SVG or IMGs, you can create a manifest.json file in the root of your CDN (likehttps://spa-mock-statics.surge.sh/manifest.json`).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@s-ui/bundler",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.68.0",
|
|
4
4
|
"description": "Config-free bundler for ES6 React apps.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"sui-bundler": "./bin/sui-bundler.js"
|
|
@@ -45,20 +45,21 @@
|
|
|
45
45
|
"html-webpack-plugin": "5.5.0",
|
|
46
46
|
"https-browserify": "1.0.0",
|
|
47
47
|
"mini-css-extract-plugin": "2.7.7",
|
|
48
|
-
"postcss-loader": "7.3.4",
|
|
49
48
|
"postcss": "8.4.31",
|
|
49
|
+
"postcss-loader": "7.3.4",
|
|
50
50
|
"process": "0.11.10",
|
|
51
51
|
"react-refresh": "0.14.0",
|
|
52
52
|
"sass": "1.54.5",
|
|
53
53
|
"stream-http": "3.2.0",
|
|
54
54
|
"strip-ansi": "6.0.1",
|
|
55
55
|
"style-loader": "3.3.4",
|
|
56
|
+
"svg-spritemap-webpack-plugin": "4.6.0",
|
|
56
57
|
"swc-loader": "0.2.6",
|
|
57
58
|
"tailwindcss": "3.4.14",
|
|
58
59
|
"url": "0.11.0",
|
|
60
|
+
"webpack": "5.82.1",
|
|
59
61
|
"webpack-dev-server": "5.0.4",
|
|
60
62
|
"webpack-manifest-plugin": "5.0.0",
|
|
61
|
-
"webpack-node-externals": "3.0.0"
|
|
62
|
-
"webpack": "5.82.1"
|
|
63
|
+
"webpack-node-externals": "3.0.0"
|
|
63
64
|
}
|
|
64
65
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const SVGSpritemapPlugin = require('svg-spritemap-webpack-plugin')
|
|
2
|
+
const {config} = require('./config.js')
|
|
3
|
+
|
|
4
|
+
const createSVGSpritemapPlugin = () => {
|
|
5
|
+
const {spritemaps = []} = config
|
|
6
|
+
|
|
7
|
+
return spritemaps.map(({path, options = {}}) => {
|
|
8
|
+
return new SVGSpritemapPlugin(path, options)
|
|
9
|
+
})
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
module.exports = createSVGSpritemapPlugin
|
|
@@ -12,6 +12,7 @@ const {withHydrationOverlayWebpack} = require('@builder.io/react-hydration-overl
|
|
|
12
12
|
const {envVars, MAIN_ENTRY_POINT, config, cleanList, when, isTailwindEnabled} = require('./shared/index.js')
|
|
13
13
|
const definePlugin = require('./shared/define.js')
|
|
14
14
|
const manifestLoaderRules = require('./shared/module-rules-manifest-loader.js')
|
|
15
|
+
const createSVGSpritemapPlugin = require('./shared/svg-spritemap')
|
|
15
16
|
const {aliasFromConfig, defaultAlias} = require('./shared/resolve-alias.js')
|
|
16
17
|
const {supportLegacyBrowsers, cacheDirectory} = require('./shared/config.js')
|
|
17
18
|
|
|
@@ -88,7 +89,8 @@ const webpackConfig = {
|
|
|
88
89
|
new ReactRefreshWebpackPlugin({overlay: false}),
|
|
89
90
|
new HtmlWebpackInjectAttributesPlugin({
|
|
90
91
|
crossorigin: 'anonymous'
|
|
91
|
-
})
|
|
92
|
+
}),
|
|
93
|
+
...createSVGSpritemapPlugin()
|
|
92
94
|
],
|
|
93
95
|
resolveLoader,
|
|
94
96
|
module: {
|
package/webpack.config.prod.js
CHANGED
|
@@ -15,6 +15,7 @@ const {extractComments, sourceMap, supportLegacyBrowsers, cacheDirectory} = requ
|
|
|
15
15
|
const {resolveLoader} = require('./shared/resolve-loader.js')
|
|
16
16
|
const createCompilerRules = require('./shared/module-rules-compiler.js')
|
|
17
17
|
const sassRules = require('./shared/module-rules-sass.js')
|
|
18
|
+
const createSVGSpritemapPlugin = require('./shared/svg-spritemap')
|
|
18
19
|
const definePlugin = require('./shared/define.js')
|
|
19
20
|
const manifestLoaderRules = require('./shared/module-rules-manifest-loader.js')
|
|
20
21
|
const minifyCss = require('./shared/minify-css.js')
|
|
@@ -100,7 +101,8 @@ const webpackConfig = {
|
|
|
100
101
|
template: './index.html'
|
|
101
102
|
}),
|
|
102
103
|
new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/runtime/]),
|
|
103
|
-
new WebpackManifestPlugin({fileName: 'asset-manifest.json'})
|
|
104
|
+
new WebpackManifestPlugin({fileName: 'asset-manifest.json'}),
|
|
105
|
+
...createSVGSpritemapPlugin()
|
|
104
106
|
]),
|
|
105
107
|
module: {
|
|
106
108
|
rules: cleanList([
|