Skip to content

Commit

Permalink
feat: use @videojs/babel-config (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonocasey committed Oct 5, 2020
1 parent aa592a2 commit f522b73
Show file tree
Hide file tree
Showing 3 changed files with 170 additions and 106 deletions.
27 changes: 10 additions & 17 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ const {terser} = require('rollup-plugin-terser');
const istanbul = require('rollup-plugin-istanbul');
const path = require('path');

const transformObjectAssign = require('@babel/plugin-transform-object-assign');
const transformRuntime = require('@babel/plugin-transform-runtime');
const presetEnv = require('@babel/preset-env');
const babelConfig = require('@videojs/babel-config/es.js');

/**
* Get the package.json from the cwd and
Expand Down Expand Up @@ -112,20 +110,15 @@ const ORDERED_DEFAULTS = {
// filter out istanbul during watch or if coverage is false
.filter((n) => !(n === 'istanbul' && (shouldChangeWatch(settings) || !settings.coverage)))
}),
babel: (settings) => ({
babelHelpers: 'runtime',
babelrc: false,
skipPreflightCheck: true,
exclude: path.join(process.cwd(), 'node_modules/**'),
compact: false,
presets: [
[presetEnv, {bugfixes: true, loose: true, modules: false, targets: {browsers: settings.browserslist}}]
],
plugins: [
[transformRuntime, {regenerator: false}],
transformObjectAssign
]
}),
babel(settings) {
const config = Object.assign({}, babelConfig);

config.presets[0][1].targets.browsers = settings.browserslist;
config.babelHelpers = 'runtime';
config.skipPreflightCheck = true;

return config;
},
excludeCoverage: () => ['test/**', path.join(__dirname, '**'), 'node_modules/**', 'package.json'],
primedPlugins: (settings) => ({
babel: babel(settings.babel),
Expand Down
Loading

0 comments on commit f522b73

Please sign in to comment.