Skip to content
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

Nollup get stuck constantly building if there are file modifications by plugins after a build #207

Open
YonicDev opened this issue Jul 29, 2021 · 1 comment

Comments

@YonicDev
Copy link

If there is a plugin that modifies a file within the watching root directory after a build (e.g. rollup-plugin-copy), Nollup will perform another build operation, ending up in a infinite building loop.

rollup.config.js:

import copy from 'rollup-plugin-copy'

const outputPath = path.join('./build',proc.env.BUILD_TYPE==="production"?"prod":"dev");

let config = {
    treeshake: true,
    input: './src/main.js',
    output: {
        file: path.join(outputPath,'app.js'),
        format: 'es'
    },
    plugins: [
        copy({targets:[
            { src: 'assets/**/*', dest: outputPath },
        ]}),
    ]
}

While this would enable support for HMR on static assets, this might create unstable behaviour in the server, as well as polluting the server console with build messages.
I'm not sure if there is an existing workaround, or if there could be a better way to pack assets for both development and production builds.

@PepsRyuu
Copy link
Owner

Plugins should be avoiding writing to disk during build hooks. Instead they need to be written to either use emitFile() or use a write hook like writeBundle. This unfortunately affects a number of plugins, since they were often written with production builds in mind rather than with a dev server.

Since it's a third party plugin, you can add an exclude rule for watching, as demonstrated here: #101 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants