Skip to content

Commit e09b447

Browse files
committed
Use ESM for the babel config
1 parent b204f62 commit e09b447

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

files/_js_babel.config.cjs renamed to files/_js_babel.config.mjs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
const {
1+
import { createRequire } from 'module';
2+
import { fileURLToPath } from 'url';
3+
4+
import {
25
babelCompatSupport,
36
templateCompatSupport,
4-
} = require('@embroider/compat/babel');
7+
} from '@embroider/compat/babel';
8+
9+
const require = createRequire(import.meta.url);
510

6-
module.exports = {
11+
export default {
712
plugins: [
813
[
914
'babel-plugin-ember-template-compilation',
@@ -28,7 +33,7 @@ module.exports = {
2833
[
2934
'@babel/plugin-transform-runtime',
3035
{
31-
absoluteRuntime: __dirname,
36+
absoluteRuntime: fileURLToPath(new URL('.', import.meta.url)),
3237
useESModules: true,
3338
regenerator: false,
3439
},

files/_ts_babel.config.cjs renamed to files/_ts_babel.config.mjs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
const {
1+
import { createRequire } from 'module';
2+
import { fileURLToPath } from 'url';
3+
4+
import {
25
babelCompatSupport,
36
templateCompatSupport,
4-
} = require('@embroider/compat/babel');
7+
} from '@embroider/compat/babel';
8+
9+
const require = createRequire(import.meta.url);
510

611
module.exports = {
712
plugins: [
@@ -36,7 +41,7 @@ module.exports = {
3641
[
3742
'@babel/plugin-transform-runtime',
3843
{
39-
absoluteRuntime: __dirname,
44+
absoluteRuntime: fileURLToPath(new URL('.', import.meta.url)),
4045
useESModules: true,
4146
regenerator: false,
4247
},

0 commit comments

Comments
 (0)