-
-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
https://ghub.now.sh/babel-preset-optimise
@babel/plugin-syntax-import-meta(always included, even when notoptions.typescriptenabled)@babel/plugin-transform-flow-strip-types(ifoptions.typescriptdisabled)babel-plugin-transform-replace-expressions(thruoptions.defines)babel-plugin-macros, cuz why not@resugar/codemod-modules-commonjs(part of previously knownesnextproject), for converting CJS to ESM- add
options.esmodules- if true, expects CJS input and converts it to ESM; - force disable if
options.rollupwhich will mean that you use Rollup + Commonjs plugin + Rollup Babel plugin, in which case Rollup's Commonjs plugin deals with CJS input okay - (always) opposite of
options.commonjs
- add
babel-plugin-add-import-extensionadds/replaces extensions- fixing the weird, and even more the freaking, officially recommended approach by the TypeScript team, like:
- write
.jsextensions inside TS soruce code to reference.tsfiles, sorry what?! 😱 no thanks
automatically adds /index.${extension} if it's a dir
- import foo from './lib';
+ import foo from './lib/index.js';a bug:
- import foo from './';
+ import foo from './/index.js';but this works
- import foo from '.';
+ import foo from './index.js';or
- import foo from './bar';
+ import foo from './bar.js';or with replace: true option
- import foo from './src/index.ts';
+ import foo from './src/index.js';there's also an extension option to the plugin, which is cool too.
Like, forcing some ext with extension: 'ts'
- import foo from './bar';
+ import foo from './bar.ts';and with both options { extension: 'ts', replace: true }
- import foo from './bar.js';
+ import foo from './bar.ts';Metadata
Metadata
Assignees
Labels
No labels