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
bug #1247 bug: accept use with addPlugin only (gimler)
This PR was merged into the main branch.
Discussion
----------
bug: accept use with addPlugin only
i have a multi config setup. In one of my configs i only call `addPlugin()`.
```js
const path = require('node:path');
const fileName = process.env.COPY_FILE_NAME || false;
let copyConfig = {};
if (fileName) {
copyConfig = {
from: `${fileName}`,
to: `${path.dirname(path.relative(path.resolve(__dirname, 'picture'), fileName))}/[name].[contenthash:8][ext]`,
}
} else {
copyConfig = {
from: './picture',
to: '[path][name].[contenthash:8][ext]'
}
Encore.cleanupOutputBeforeBuild()
};
const CopyPlugin = require('copy-webpack-plugin');
Encore
...
.addPlugin(
new CopyPlugin({
patterns: [copyConfig],
})
)
...
```
this config only copy files optional only a specific ;)
Actually only use `addPlugin()` is not supported. I change the code and add test for the scenario.
releated #1140
Commits
-------
1bfd797 bug: accept use with addPlugin only
Copy file name to clipboardExpand all lines: lib/config/validator.js
+2-1
Original file line number
Diff line number
Diff line change
@@ -43,8 +43,9 @@ class Validator {
43
43
if(this.webpackConfig.entries.size===0
44
44
&&this.webpackConfig.styleEntries.size===0
45
45
&&this.webpackConfig.copyFilesConfigs.length===0
46
+
&&this.webpackConfig.plugins.length===0
46
47
){
47
-
thrownewError('No entries found! You must call addEntry() or addEntries() or addStyleEntry() or copyFiles() at least once - otherwise... there is nothing to webpack!');
48
+
thrownewError('No entries found! You must call addEntry() or addEntries() or addStyleEntry() or copyFiles() or addPlugin() at least once - otherwise... there is nothing to webpack!');
0 commit comments