You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -530,15 +533,15 @@ See [boilerplate](https://github.com/webdiscus/webpack-html-scss-boilerplate)
530
533
-[extracts JS](#option-js) from the source script filename specified in HTML via a `<script>` tag
531
534
-[extracts CSS](#option-css) from the source style filename specified in HTML via a `<link>` tag
532
535
- importing style files in JavaScript
533
-
- resolves source asset files in HTML attributes and in the CSS `url()`
536
+
- resolves source asset files in HTML attributes and in the CSS `url()`, without using [resolve-url-loader](https://github.com/bholloway/resolve-url-loader)
534
537
- supports styles used in `*.vue` files
535
538
- generated HTML contains output filenames
536
539
- supports the module types `asset/resource``asset/inline``asset``asset/source` ([\*](#note-asset-source))
537
540
-[inline CSS](#recipe-inline-css) in HTML
538
541
-[inline JavaScript](#recipe-inline-js) in HTML
539
542
-[inline image](#recipe-inline-image) as `base64 encoded` data-URL for PNG, JPG, etc. in HTML and CSS
540
-
-[inline SVG](#recipe-inline-image) as SVG tag in HTML
541
-
-[inline SVG](#recipe-inline-image) as `utf-8` data-URL in CSS
543
+
-[inline SVG](#recipe-inline-image) as SVG tag in HTML, e.g.: `<svg>...</svg>`
544
+
-[inline SVG](#recipe-inline-image) as `utf-8` data-URL in CSS, e.g.: `url("data:image/svg+xml,<svg>...</svg>")`
542
545
- auto generation of `<link rel="preload">` to [preload assets](#option-preload)
543
546
- supports the `auto`[publicPath](#webpack-option-output-publicpath)
544
547
- enable/disable [extraction of comments](#option-extract-comments) to `*.LICENSE.txt` file
@@ -5173,8 +5176,96 @@ loadCSS(cssFile);
5173
5176
5174
5177
The CSS will be extracted into separate file and the `cssFile` variable will contains the CSS output filename.
> Don't use `@import in CSS`. It's very `bad practice`.
5959
+
>
5960
+
5961
+
Bad example, _main.css_:
5962
+
```css
5963
+
@import'path/to/style.css';
5964
+
```
5965
+
5966
+
The plugin does not support handling of `@import url()` in CSS. Imported url will be passed 1:1 into resulting CSS.
5967
+
5968
+
**Problem:** defaults, `css-loader` handles `@import at-rule`, which causes an issue in the plugin.
5969
+
5970
+
**Solution:** add the `import: false` into `css-loader` options:
5971
+
5972
+
```js
5973
+
{
5974
+
test:/\.(css)$/i,
5975
+
loader:'css-loader',
5976
+
options: {
5977
+
import:false, // disable handling of @import at-rule in CSS
5978
+
},
5979
+
},
5980
+
```
5981
+
5982
+
> **Warning**
5983
+
>
5984
+
> The `*.css` files imported in CSS are not handled, therefore these files must be manually copied to the `dist/` folder using the `copy-webpack-plugin`.
5859
5985
5860
5986
#### [↑ back to contents](#contents)
5861
5987
5988
+
---
5989
+
5990
+
5862
5991
## Also See
5863
5992
5864
5993
- [ansis][ansis] - The Node.js lib for ANSI color styling of text in terminal
A symbiosis of the fast RSPack and the powerful [html-bundler-webpack-plugin](https://github.com/webdiscus/html-bundler-webpack-plugin) could be a `Vite` killer.
4
+
5
+
But currently RSPack `v0.5.6` is yet not 100% compatible with the Webpack.
6
+
7
+
Using the `html-bundler-webpack-plugin` with `RSPack` occurs the issue:
__classPrivateFieldSet(this, _Compiler_instance, new instanceBinding.Rspack(rawOptions, this.builtinPlugins, {
12
+
^
13
+
14
+
Error: Failed to convert JavaScript value `function filenameFn(..) ` into rust type `String`
15
+
16
+
at Compiler._Compiler_getInstance (/Users/xxxx/html-bundler-webpack-plugin/experiments/rspack/node_modules/@rspack/core/dist/Compiler.js:518:54)
17
+
at Compiler.build (/Users/xxxx/html-bundler-webpack-plugin/experiments/rspack/node_modules/@rspack/core/dist/Compiler.js:384:87)
18
+
at /Users/xxxx/html-bundler-webpack-plugin/experiments/rspack/node_modules/@rspack/core/dist/Watching.js:263:23
19
+
at Hook.eval [as callAsync] (eval at create (/Users/xxxx/html-bundler-webpack-plugin/experiments/rspack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
20
+
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/xxxx/html-bundler-webpack-plugin/experiments/rspack/node_modules/tapable/lib/Hook.js:18:14)
21
+
at Watching._Watching_go (/Users/xxxx/html-bundler-webpack-plugin/experiments/rspack/node_modules/@rspack/core/dist/Watching.js:253:34)
22
+
at Watching._Watching_invalidate (/Users/xxxx/html-bundler-webpack-plugin/experiments/rspack/node_modules/@rspack/core/dist/Watching.js:217:74)
23
+
at /Users/xxxx/html-bundler-webpack-plugin/experiments/rspack/node_modules/@rspack/core/dist/Watching.js:51:94
24
+
at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
0 commit comments