Skip to content

Commit

Permalink
AE-2164: Fix imports in Jest tests using es modules by setting etp-fr…
Browse files Browse the repository at this point in the history
…ont project to type module in package.json

- Configuration files that are common js instead of es modules renamed to cjs to support this change
- Configure webpack to not require file extensions in imports
  • Loading branch information
Juholei committed Apr 16, 2024
1 parent d7bafb6 commit 69cd20c
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 5 deletions.
8 changes: 4 additions & 4 deletions etp-front/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
!.storybook/
!__snapshots__/

!babel.config.js
!babel.config.cjs
!fill-sv-localization.js
!init-mocha.js
!jsconfig.json
!modheaders.json
!postcss.config.js
!svelte.config.js
!postcss.config.cjs
!svelte.config.cjs
!tailwind.config.js
!webpack.config.js
!webpack.config.cjs

!run-visual-tests.sh
2 changes: 1 addition & 1 deletion etp-front/babel.config.js → etp-front/babel.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: 3
corejs: 3,
}
]
],
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions etp-front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"build:docs": "jsdoc -r -c ./jsdoc/conf.json",
"watch:docs": "nodemon --exec npm run build:docs --watch src"
},
"type": "module",
"browserslist": [
"defaults"
],
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions etp-front/webpack.config.js → etp-front/webpack.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,18 @@ module.exports = {
rules: [
{
test: /\.m?js$/,
resolve: {
fullySpecified: false
},
exclude: /node_modules/,
include: [path.resolve(__dirname, 'src'), /svelte/],
use: ['babel-loader']
},
{
test: /\.svelte$/,
resolve: {
fullySpecified: false
},
include: [path.resolve(__dirname, 'src'), /svelte/],
use: [
'babel-loader',
Expand Down

0 comments on commit 69cd20c

Please sign in to comment.