Replies: 1 comment 1 reply
-
Rsbuild does not provide a config option to do this, but you can remove the JS files by adding a tiny Rspack plugin. Example: // rsbuild.config.ts
import { defineConfig } from '@rsbuild/core';
class RemoveJsPlugin {
apply(compiler) {
compiler.hooks.compilation.tap('RemoveJsPlugin', (compilation) => {
compilation.hooks.processAssets.tap(
{
name: 'RemoveJsPlugin',
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE,
},
() => {
for (const name of Object.keys(compilation.assets)) {
if (name.endsWith('.js')) {
compilation.deleteAsset(name);
}
}
},
);
});
}
}
export default defineConfig({
source: {
entry: {
style: './src/style.css',
},
},
tools: {
rspack: {
plugins: [new RemoveJsPlugin()],
},
},
}); |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a small project with no
js
files.But I'd like to use rsbuild for the
css
files.How can I rsbuild
css
files withoutjs
files?I set the entry like this:
But there is still a
style.js
generated.Besides that, the small images I imported in
css
files are also exported to thisjs
file.That mean there are duplicated base64 data for the same image in
css
file andjs
file.Beta Was this translation helpful? Give feedback.
All reactions