-
-
Notifications
You must be signed in to change notification settings - Fork 8k
vite:define plugin will replace module or path-name keyword in defines #5616
Copy link
Copy link
Closed
Labels
Description
Describe the bug
if some lib, folder or file-name have some keyword defined in define property, and run vite build will casue [vite]: Rollup failed to resolve import error.
After checked source code and found some casue on follow picture.

Reproduction
open this link https://stackblitz.com/edit/vite-hxw2x7 and see Terminal output
System Info
System:
OS: macOS 12.0.1
CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
Memory: 224.04 MB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.13.0 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 8.1.0 - /usr/local/bin/npm
Browsers:
Chrome: 95.0.4638.69
Firefox: 78.15.0
Safari: 15.1
npmPackages:
vite: workspace:* => 2.7.0-beta.3
### Used Package Manager
pnpm
### Logs
_No response_
### Validations
- [X] Follow our [Code of Conduct](https://github.com/vitejs/vite/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://vitejs.dev/guide).
- [X] Check that there isn't [already an issue](https://github.com/vitejs/vite/issues) that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitejs/vite/discussions) or join our [Discord Chat Server](https://chat.vitejs.dev/).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
Reactions are currently unavailable