-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Closed
Labels
bugIssue was opened via the bug report template.Issue was opened via the bug report template.
Description
What version of Next.js are you using?
11.0.1
What version of Node.js are you using?
v14.5.0
What browser are you using?
Chrome
What operating system are you using?
macOs
How are you deploying your application?
next build
Describe the Bug
new webpack.BannerPlugin({
banner: '/** some text */'
})But i run the command 'next build', the js and css trunks not see the copyright. I sure the reason cause by webpack5 and next11.
Expected Behavior
Can you tell me how do this?
To Reproduce
const { Compilation, sources } = require('webpack')
class BannerPlugin {
constructor(options) {
this.banner = options.banner
}
apply(compiler) {
compiler.hooks.compilation.tap('BannerPlugin', (compilation) => {
compilation.hooks.processAssets.tap(
{
name: 'BannerPlugin',
stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
},
(assets) => {
Object.entries(assets).forEach(([pathname, source]) => {
compilation.updateAsset(
pathname,
new sources.RawSource(this.banner + source.source())
)
})
}
)
})
}
}
module.exports = BannerPluginMetadata
Metadata
Assignees
Labels
bugIssue was opened via the bug report template.Issue was opened via the bug report template.