Error when importing CommonJS module that contains files like module.scss.js
#16116
Closed
7 tasks done
Labels
feat: deps optimizer
Esbuild Dependencies Optimization
p3-minor-bug
An edge case that only affects very specific usage (priority)
Describe the bug
I am importing a CommonJS module installed from NPM. The modue contains files with filenames like
PeoplePicker.scss.js
. These are JavaScript files, obviously, but the filename containsscss
.I'd expect Vite to handle these like any other JavaScript files when I run the dev server via
vite
. What actually happens is that it seems like Vite externalizes those files (forgive me if I don't fully understand what's going on, but that's my best guess), and so anything trying to import them as JavaScript is unable to do so. See the error logs.It seems like Vite is getting tripped up by the
scss
in the filename. The same thing happens for any${extension}.js
filename whereextension
is considered an external type. See what I believe to be the relevant file (esbuildDepPlugin.ts).Reproduction
https://github.com/noahmpauls/vite-commonjs-external-bug
Steps to reproduce
Run
npm install
followed bynpm run -w app dev
. The reproduction isn't applicable to thebuild
script.System Info
Used Package Manager
npm
Logs
Click to expand!
Validations
The text was updated successfully, but these errors were encountered: