-
Notifications
You must be signed in to change notification settings - Fork 124
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
Surprising output in rollup bundle sourcemaps for none .js entrypoint files #358
Comments
So I was able to apply a fix locally that worked for this case as a proof of concept. vite_ruby/vite-plugin-ruby/src/index.ts Lines 90 to 100 in 4ee5aa8
Changed to: function outputOptions (assetsDir, ssrBuild) {
const outputFileName = (ext) => ({ name }) => {
const shortName = basename(name).split('.')[0]
let indexOfDot = name.lastIndexOf(".");
if (indexOfDot > -1) {
let extension = name.substring(indexOfDot + 1, name.length);
if (ext !== extension && extension === "sass") {
extension = "css";
}
ext = extension;
}
return posix.join(assetsDir, `${shortName}-[hash].${ext}`)
};
return {
entryFileNames: ssrBuild ? undefined : outputFileName('js'),
};
} |
Hi Joe! Thanks for providing a detailed report. It's likely that We should probably let Rollup do its thing by using |
bundle update vite_ruby
.Description 📖
I'm wondering if this might be a bug that results from this:
vite_ruby/vite-plugin-ruby/src/index.ts
Line 98 in 4ee5aa8
When enabling sourcemaps, and running a build via
bin/vite build
orrails assets:precompile
, if I write a rollup plugin to inspect the sourcemap files, I see that a sourcemap entry exists for a.sass
file that I have as an entry point, even though no such file exists in the actual build output. Also I see that the filename for thesass
has a.js
extension which seems strange.Reproduction 🐞
app/frontend/entrypoints
directory, include at least one.sass
file. Ex.rollupPlugin
code to yourvite.config.ts
Rollup plugin code
vite.config.ts
file and make sure you have sourcemaps enabled:vite.config.ts
bin/vite build
In your console output you will see something like:
What's surprising here is that the
file
is a.js
file! Also note that most of the properties are empty values since the source is not actually a .js file. It's the quill.sass file.ℹ️ In the example screenshot of my
entrypoints
posted on reproduction Step 1 (above), you can see that I have aquill.js
andquill.sass
file. The output above is for thequill.sass
entry file. Thequill.js
entrypoint's bundle sourcemap Object is what is expected. Something like this:Vite Ruby Info
Run
bin/rake vite:info
and provide the output:Screenshots 📷
Provide console or browser screenshots of the problem.
The text was updated successfully, but these errors were encountered: