summaryrefslogtreecommitdiff
path: root/@linaria/babel.config.js
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2021-08-23 16:46:06 -0300
committerSebastian <sebasjm@gmail.com>2021-08-23 16:48:30 -0300
commit38acabfa6089ab8ac469c12b5f55022fb96935e5 (patch)
tree453dbf70000cc5e338b06201af1eaca8343f8f73 /@linaria/babel.config.js
parentf26125e039143b92dc0d84e7775f508ab0cdcaa8 (diff)
downloadnode-vendor-38acabfa6089ab8ac469c12b5f55022fb96935e5.tar.gz
node-vendor-38acabfa6089ab8ac469c12b5f55022fb96935e5.tar.bz2
node-vendor-38acabfa6089ab8ac469c12b5f55022fb96935e5.zip
added web vendorsHEADmaster
Diffstat (limited to '@linaria/babel.config.js')
-rw-r--r--@linaria/babel.config.js93
1 files changed, 93 insertions, 0 deletions
diff --git a/@linaria/babel.config.js b/@linaria/babel.config.js
new file mode 100644
index 0000000..bd6956b
--- /dev/null
+++ b/@linaria/babel.config.js
@@ -0,0 +1,93 @@
+/*
+ * The following environments are supported:
+ *
+ * (unspecified): Produces ES module output, no language features
+ * (except non-standard ones) are transpiled.
+ * "legacy": Produces CommonJS output, uses @babel/preset-env to target
+ * Node.js 10 and specific browsers.
+ * "test": Used by Jest, produces CommonJS output, targetting
+ * the current Node.js version.
+ */
+
+/*
+ * Configuration for the legacy build
+ */
+
+const commonJSTargets = {
+ browsers: ['last 2 versions', 'not op_mini all', 'not dead'],
+ node: '10',
+};
+
+module.exports = {
+ presets: ['@babel/preset-typescript'],
+ plugins: ['@babel/plugin-proposal-class-properties'],
+ env: {
+ legacy: {
+ presets: [
+ [
+ '@babel/preset-env',
+ {
+ targets: {
+ node: commonJSTargets.node,
+ },
+ },
+ ],
+ ],
+ },
+ test: {
+ presets: [
+ [
+ '@babel/preset-env',
+ {
+ targets: {
+ node: '10',
+ },
+ },
+ ],
+ ],
+ },
+ },
+ overrides: [
+ {
+ /**
+ * only react and core packages are targeted to be run in the browser
+ */
+ test: /\/packages\/((react)|(core))\//,
+ presets: ['@babel/preset-react'],
+ env: {
+ legacy: {
+ presets: [
+ [
+ '@babel/preset-env',
+ {
+ targets: {
+ browsers: commonJSTargets.browsers,
+ },
+ loose: true,
+ // our styled component should not need to use any polyfill. We do not include core-js in dependencies. However, we leave this to detect if future changes would not introduce any need for polyfill
+ useBuiltIns: 'usage',
+ // Even core-js doesn't remember IE11
+ exclude: [
+ /es\.array\.(?:filter|for-each|index-of|join|reduce|slice)/,
+ 'es.function.name',
+ 'es.object.keys',
+ 'web.dom-collections.for-each',
+ ],
+ corejs: 3,
+ // this is used to test if we do not introduced core-js polyfill
+ debug: process.env.DEBUG_CORE_JS === 'true',
+ },
+ ],
+ ],
+ },
+ },
+ },
+ {
+ /**
+ * we have to transpile JSX in tests
+ */
+ test: /\/((__tests__)|(__fixtures__))\//,
+ presets: ['@babel/preset-react'],
+ },
+ ],
+};