New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy before rest of build process? #286
Comments
PR welcome |
Close in favor #195 |
Achieved this on my end with event hooks (like in 195). But I still find it delightfully ironic that something named CopyWebpackPlugin doesn't actually Copy things. Like... what went wrong there? |
@martixy What do you mean? |
@martixy could you share your solution? |
@marcelo2605 My solution goes like this: new EventHooksPlugin({
compile: () => {
console.log('Copying config.');
if (!fs.existsSync(path.resolve(__dirname, 'config/config.json'))) {
fs.copyFileSync(
path.resolve(__dirname, 'config/config.json.dist'),
path.resolve(__dirname, 'config/config.json')
)
} else {
console.log('config.json exists, skipping copy.');
}
}
}), @evilebottnawi What I mean is that I have to use the above approach instead of this: {
from: path.resolve(__dirname, 'config/config.json.dist'),
to: path.resolve(__dirname, 'config/config.json'),
force: false
} because not only does the build process fail if it depends on the |
I have a build dependency which needs to be copied over before the project can be built.
Currently the build fails, as it seems the plugin is running AFTER the rest of the build process.
Is there a setting, or something that would make the copy happen before the build?
My use case is a (not sure how well known in js-land) pattern of having a
config.json.dist
, which contains default values and having your build process create / merge new config options toconfig.js
, which itself is gitignored.Edit: Issue seems similar to this: #195
But I'm not sure of exactly identical. Though the solution he offered will probably help.
Though it is kind of ironic that I have to use the copy plugin to process some data and not be able to do it to actually copy a file.
The text was updated successfully, but these errors were encountered: