Skip to content

Option to rerun provider fonction every rebuild #9

@OoDeLally

Description

@OoDeLally
{
  //...
  watch: {
    input: [
      // ...
      './src/fileToInject.txt',
    ],
  },
  plugins: [
    // ...
    replace({
      replaces: {
        __PLACEHOLDER__: (data) => {
          return fs.readFileSync('./src/fileToInject.txt', 'utf-8')
        },
      }
    })
  ],
}

Expected result:

Everytime I modify fileToInject.txt, I would like my bundle to be updated with the latest content.

Current result:

Currently the function is evaluated only once at the first build. When the watcher detects a change, the bundle is rebuilt, but the replace plugin reuses the last value returned by the function. Therefore my bundle is not updated.

Solution:

Provide a evaluateEveryTime or such option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions