modify-source-webpack-plugin icon indicating copy to clipboard operation
modify-source-webpack-plugin copied to clipboard

This will broke webpack cache when the value be repleaced is dynamic

Open Shangyunliang opened this issue 1 year ago • 4 comments

dose anyone have some idea to resolve this ?

Shangyunliang avatar May 19 '23 02:05 Shangyunliang

Hi! Last versions shouldn't broke webpack cache. Which version of plugin do you use?

artembatura avatar May 19 '23 02:05 artembatura

new ModifySourcePlugin({
     rules: [
        {
            test: /App.tsx$/,
            operations: [new ReplaceOperation("all", "GIT_VERSION", Current_Git_Version)],
        }
      ]
})

i use the lastest version like this, but Current_Git_Version is change when git commit is change, when the commitid is changed. the cache will be broke. i think maybe the git version change will broke cache. do you have some idea to replace the 'GIT_VERSION' string with dynamic value but do not rebuild, only replace the value in chunk

Shangyunliang avatar May 19 '23 06:05 Shangyunliang

When commit hash is changed, then you running build again but result doesn't change?

artembatura avatar May 20 '23 22:05 artembatura

@artembatura the result is been replaced. but the process is broke the cache that make webpack will rebuild all module. have any idea to change the result but do not make webpack rebuild all module?

Shangyunliang avatar May 22 '23 02:05 Shangyunliang