Closed mistic100 closed 1 year ago
Will I noticed (after reading esbuild doc) that this plugin might not be useful in many basic cases. The same result can be obtained with the loader
option.
esbuild --loader:.svg=text
// tsup.config.js
export default defineConfig((options) => {
return {
entryPoints: ['src/index.ts'],
esbuildPlugins: [
// rawPlugin(),
],
esbuildOptions(options, context) {
options.loader = {
'.svg': 'text',
};
},
clean: true,
}
});
Describe the bug
I am using this plugin to load SVG files into my lib.
When I look at the generated files I can see comments like :
=> the plugin is outputing the full file path into the generated files. Beside being not very clean, I think it could lead to information leak (something something about system structure on a corporate computer).
I tried to replace this line https://github.com/hannoeru/esbuild-plugin-raw/blob/1698f08e3761d7d3e9378cf837d4f6fe354d690d/src/index.ts#L11 by
path: args.path
and it seems to continue working without any issue and now the comment is simplyI guess the path resolution is here to handle more complex cases, perhaps it could be done only in
onLoad
Reproduction
https://github.com/mistic100/temp-esbuild-raw
System Info
Used Package Manager
yarn
Validations