Skip to content

Instantly share code, notes, and snippets.

@dimfeld
Last active June 5, 2020 02:10
Show Gist options
  • Save dimfeld/bd18666f41280d3f80ad17364dbaf809 to your computer and use it in GitHub Desktop.
Save dimfeld/bd18666f41280d3f80ad17364dbaf809 to your computer and use it in GitHub Desktop.
Babel Config Sample
const babelServerConfig = {
extensions: ['.js', '.mjs', '.html', '.ts'],
babelHelpers: 'bundled',
exclude: ['node_modules/@babel/**'],
presets: [
[
'@babel/preset-env',
{
modules: false,
targets: { node: 12 },
},
],
'@babel/preset-typescript',
],
plugins: [
'@babel/plugin-syntax-dynamic-import',
'@babel/proposal-class-properties',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-nullish-coalescing-operator',
'@babel/plugin-proposal-optional-chaining',
],
};
const babelClientConfig = {
...babelServerConfig,
exclude: ['node_modules/@babel/**'],
presets: [
[
'@babel/preset-env',
{
// won't run on IE11 but will on almost anything newer
targets: { esmodules: true },
// Or use this instead this to run on almost any browser
// targets: '> 0.25%, not dead'
},
],
'@babel/preset-typescript',
],
};
"@babel/core": "^7.7.0",
"@babel/plugin-proposal-class-properties": "^7.7.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4",
"@babel/plugin-proposal-object-rest-spread": "^7.6.2",
"@babel/plugin-proposal-optional-chaining": "^7.6.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/preset-env": "^7.7.0",
"@babel/preset-typescript": "^7.7.0",
"@rollup/plugin-babel": "^5",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment