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
I'm attempting to rewrite the PinoWebpackPlugin so that it works with Rspack. The trouble I am experiencing is that the processed output of the Pino transports (that must be Node worker-compatible) is full of webpackMissingModule errors for the Node built-ins (such as os and path). The output of the project using the plugin is fine. The project's rspack.config.ts sets target: 'node' and externalsPresets: { node: true }, and it appears that the child compiler inherits those options.
The apply method of my plugin is below. What am I missing that will configure Rspack to properly apply the child compiler's "externals"?
Thanks in advance
Simon
Edit: @rspack/core@1.6.4 and @rspack/cli@1.6.4
apply(compiler: Compiler){// eslint-disable-next-line @typescript-eslint/naming-conventionconstBannerPlugin=compiler.webpack.BannerPlugin;// eslint-disable-next-line @typescript-eslint/naming-conventionconstEntryPlugin=compiler.webpack.EntryPlugin;// Add the transport look-up header to all entries.newBannerPlugin({entryOnly: true,raw: true,banner: this.makeOverridesHeader()}).apply(compiler);compiler.hooks.make.tapAsync(PLUGIN_NAME,(compilation,callback)=>{constchildCompiler=compilation.createChildCompiler(`${PLUGIN_NAME}ChildCompiler`,{library: {type: 'commonjs2',},iife: false,},[],);// Add the compatibility footer to all transports.newBannerPlugin({footer: true,raw: true,banner: compatibilityFooter}).apply(childCompiler);for(consttransportofthis.transports){constsource=resolve(compiler.context,'node_modules',transport.source);newEntryPlugin(compiler.context,source,{name: transport.name,filename: transport.output,}).apply(childCompiler);}childCompiler.runAsChild((err)=>{callback(err);});});}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
I'm attempting to rewrite the PinoWebpackPlugin so that it works with Rspack. The trouble I am experiencing is that the processed output of the Pino transports (that must be Node worker-compatible) is full of
webpackMissingModuleerrors for the Node built-ins (such asosandpath). The output of the project using the plugin is fine. The project'srspack.config.tssetstarget: 'node'andexternalsPresets: { node: true }, and it appears that the child compiler inherits those options.The
applymethod of my plugin is below. What am I missing that will configure Rspack to properly apply the child compiler's "externals"?Thanks in advance
Simon
Edit: @rspack/core@1.6.4 and @rspack/cli@1.6.4
Beta Was this translation helpful? Give feedback.
All reactions