Skip to content

Commit

Permalink
fixup! feat(webpack): introduce experimental esbuild transpilation
Browse files Browse the repository at this point in the history
  • Loading branch information
jhiode committed Mar 4, 2021
1 parent d75c5d7 commit 0d8c6e7
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions packages/webpack/mixins/esbuild/mixin.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ const importComponentTransform = require.resolve(
);

const isLoaderFor = (extention) => (test) => {
if (Array.isArray(test)) {
return test.some(isLoaderFor(extention));
} else if (typeof test === 'object' && typeof test.test === 'function') {
return test.test(extention);
} else if (typeof test === 'function') {
return test(extention) === true;
} else if (typeof test === 'string') {
return test === extention;
} else {
return false;
switch (true) {
case Array.isArray(test):
return test.some(isLoaderFor(extention));
case typeof test === 'object' && typeof test.test === 'function':
return test.test(extention);
case typeof test === 'function':
return test(extention) === true;
case typeof test === 'string':
return test.endsWith(extention);
default:
return false;
}
};
const isTsLoader = isLoaderFor('.ts');
Expand Down

0 comments on commit 0d8c6e7

Please sign in to comment.