diff --git a/.babelrc.js b/.babelrc.js index af40f73d..1b5d8d80 100644 --- a/.babelrc.js +++ b/.babelrc.js @@ -1,14 +1,3 @@ module.exports = { - presets: [ - [ - '@babel/env', - { - modules: process.env.MODULE ? false : 'commonjs', - targets: ['last 2 versions', 'not dead'], - }, - ], - '@babel/preset-react', - '@babel/preset-typescript', - ], - plugins: ['@babel/plugin-proposal-class-properties'], + extends: './babel.config.cjs.json', }; diff --git a/babel.config.cjs.json b/babel.config.cjs.json new file mode 100644 index 00000000..ca84faa4 --- /dev/null +++ b/babel.config.cjs.json @@ -0,0 +1,12 @@ +{ + "extends": "./babel.config.json", + "presets": [ + [ + "@babel/env", + { + "modules": "commonjs", + "targets": ["last 2 versions", "not dead"] + } + ] + ] +} diff --git a/babel.config.json b/babel.config.json new file mode 100644 index 00000000..d3384d2f --- /dev/null +++ b/babel.config.json @@ -0,0 +1,14 @@ +{ + "presets": [ + [ + "@babel/env", + { + "modules": false, + "targets": ["last 2 versions", "not dead"] + } + ], + "@babel/preset-react", + "@babel/preset-typescript" + ], + "plugins": ["@babel/plugin-proposal-class-properties"] +} diff --git a/package.json b/package.json index fa8bf12f..8408c0da 100644 --- a/package.json +++ b/package.json @@ -45,8 +45,8 @@ "update-snapshots": "jest --updateSnapshot", "build": "yarn lib:build", "lib:build": "yarn lib:build-cjs && yarn lib:build-es && yarn lib:build-styles && yarn lib:build-types", - "lib:build-cjs": "babel ./src -d lib/cjs --ignore './src/__tests__'", - "lib:build-es": "MODULE=true babel ./src -d lib/es --ignore './src/__tests__'", + "lib:build-cjs": "babel ./src -d lib/cjs --ignore './src/__tests__' --extensions '.ts,.tsx' --config-file ./babel.config.cjs.json", + "lib:build-es": "babel ./src -d lib/es --ignore './src/__tests__' --extensions '.ts,.tsx' --config-file ./babel.config.json", "lib:build-styles": "mkdir -p lib/styles && node-sass src/carousel.scss > lib/styles/carousel.css && node-sass --output-style compressed src/carousel.scss > lib/styles/carousel.min.css", "lib:build-types": "tsc -p tsconfig.types.json", "lib:pre-publish": "npm version patch && git push origin master",