Closed MinJieLiu closed 2 years ago
You can disable sourcemaps with the following:
$ microbundle --no-sourcemap
--no-sourcemap
But this will also close the sourcemap of js 😥.
I just want to disable sourcemap in css.
Not sure I follow. If your issue is that you don't ship the source so sourcemaps are ineffective, how are the JS sourcemaps of any use?
I think this is best solved by using a simple post-build script:
post-build.mjs
import { promises as fs } from 'node:fs';
let css = await fs.readFile('./dist/index.css', 'utf-8');
css = css.replace(/\r?\n.*/g, '');
await fs.writeFile('./dist/index.css', css);
await fs.rm('./dist/index.css.map');
$ microbundle && node post-build.mjs
https://github.com/developit/microbundle/blob/master/src/index.js#L489
css should not need sourcemap. It will have warnings on various scaffolding.
If it is enabled, it means that I must publish the src directory to npm, otherwise the source information in it cannot be found.
https://github.com/MinJieLiu/react-photo-view