-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
@rollup/plugin-replace issue with include/exclude options in windows #1522
Comments
The following command solved the problem. pnpm install --save-dev react |
I created another repro for the same issue, but using @rollup/plugin-strip. This one is more interesting because the issue appears with the default values, that for Here is the repro: The issue again is that in Windows Vite is normalizing paths differently from what rollup plugins expect. Rollup plugins and utilities are normalizing paths by changing the slashes to posix in all systems, but it is not removing the drive ("C:") from the paths, as Vite is doing. Here is the rollup/pluginutils normalizePath implementation: const normalizePath: NormalizePath = function(filename: string) {
return filename.split(win32.sep).join(posix.sep);
}; And here is where it is being used to normalize the paths in createFilter. If a regex is used for
Would it be possible to re-evalute the way Vite is normalizing paths for the ids? If the drive part is not removed in windows, matching the way normalization works for rollup plugins, I think this could resolve a lot of compat issues. |
@rollup/plugin-alias is also removing the volume. I see that I need more context to understand why there is an issue here. |
Is your feature request related to a problem? Please describe.
@rollup/plugin-replace is failing in windows when using
include
orexclude
options.Repro from vanilla starter
https://github.com/matias-capeletto/vite-rollup-plugin-replace
Only the
a: __REPLACE__
should reada: replaced
, because theinclude
option is only listinga.js
Describe the solution you'd like
This plugin is using
createFilter
from @rollup/pluginutils. I think this issue may be related to #1521, the filter ends up comparing normalized paths to regular resolved windows paths that include the drive.A lot of the official rollup plugins and I think other community plugins are using createFilter, and exposing
include
andexclude
options, so it would be great if there is a way to support this pattern.Additional context
vite version: 2.0.0-beta.27
Operating System: Windows 10 Home, 10.0.18363 N/A Build 18363
Node version: v15.5.0
Package manager and version: yarn v1.22.10
The text was updated successfully, but these errors were encountered: