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
Doesn't work with rollup >= 1.27.0 #79
Comments
Are you sure you placed the |
Though it might make sense to be able to use this plugin as an output plugin, it is not supported and also would not really make sense as then it would not benefit from tree-shaking. |
@targumon as the issue template mentions, we need a minimal reproduction to triage this. Without that, there's not much we can do.
|
Oh, I feel so stupid. I'm not even sure now where did I copy my bad Thanks and my apologies for the trouble! |
Found the source of my mistake: before realizing I also need the replace plugin, the first one I used was terser, which is an output plugin... So my initial config had TL;DR (for whoever gets here from search engines):
More details here: https://rollupjs.org/guide/en/#using-output-plugins |
I also have this warning when using the replace plugin as an output plugin like this export default {
input: 'index.js',
output: {
dir: 'dist',
format: 'iife', // amd cjs system esm iife umd
plugins: [
replace({'process.env.NODE_ENV': JSON.stringify('production')}),
terser(),
]
}
} In my case, I actually need it on the output bundle and it is allowed since #55. So why there is that warning? |
How Do We Reproduce?
Created a clean project:
npm i -y
, followed bynpm i -d rollup @rollup/plugin-replace
, created a small js file with just console.log in it, using the exact rollup.config.js file described under 'Usage' in https://github.com/rollup/plugins/tree/master/packages/replaceExpected Behavior
string replaced in the output
Actual Behavior
string not replaced in the output
warning in terminal: (!) The "transform" hook used by the output plugin replace is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.
I suspect the problem is related to rollup/rollup#3218
and so I'm guessing it's the documentation of the plugin that needs to be fixed, not the plugin itself.
The text was updated successfully, but these errors were encountered: