josteph / esbuild-plugin-lodash

This plugin is for esbuild, similar to how babel-plugin-lodash works for babel.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Default loader logic completely ignores Loader API

mbullington opened this issue · comments

Description

The bug comes from this line:

const loader = JS_EXTENSIONS.has(extension) ? 'jsx' : extension;

This completely ignores the https://esbuild.github.io/api/#loader API, for example in your ESBuild config if you were to do ".css": "text" this wouldn't work.

Solutions

Not sure how hard it would be, but ideally we'd check the Loader API options here.

An alternative approach would be to change the default filter so this plugin only runs on JS/JSX/TS/TSX files.