Skip to content

Commit

Permalink
Merge branch 'master' into alternative-this
Browse files Browse the repository at this point in the history
  • Loading branch information
developit authored May 15, 2021
2 parents 53cc617 + 967c2c0 commit 0b05e66
Show file tree
Hide file tree
Showing 3 changed files with 17,668 additions and 46 deletions.
34 changes: 32 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,33 @@ function createEsbuildPlugin() {
};
});

// Transpile node_modules that are es2015+ to es5 for IE11
build.onLoad({ filter: /kolorist/ }, async args => {
const contents = await fs.readFile(args.path, 'utf-8');

const tmp = await babel.transformAsync(contents, {
filename: args.path,
presets: [
[
'@babel/preset-env',
{
loose: true,
modules: false,
targets: {
browsers: ['last 2 versions', 'IE >= 9']
}
}
]
]
});

return {
contents: tmp.code,
resolveDir: path.dirname(args.path),
loader: 'js'
};
});

// Apply babel pass whenever we load a .js file
build.onLoad({ filter: /\.js$/ }, async args => {
const contents = await fs.readFile(args.path, 'utf-8');
Expand Down Expand Up @@ -290,12 +317,15 @@ module.exports = function(config) {

preprocessors: {
'{debug,devtools,hooks,compat,test-utils,jsx-runtime,}/test/**/*': [
'esbuild',
'sourcemap'
'esbuild'
]
},

esbuild: {
// karma-esbuild options
singleBundle: false,

// esbuild options
target: 'es5',
define: {
COVERAGE: coverage,
Expand Down
Loading

0 comments on commit 0b05e66

Please sign in to comment.