Skip to content

Commit

Permalink
abs resolution + default imports
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaMan123 committed Jul 19, 2023
1 parent 4f7bda2 commit 15e834a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
20 changes: 9 additions & 11 deletions e2e/.babelrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// https://github.com/viruscamp/babel-plugin-transform-imports#using-a-function-as-the-transformer

const path = require('path');
const siteDir = path.resolve('./e2e/site');
const testsDir = path.resolve('./e2e/tests');
const testsBuiltDir = path.resolve('./e2e/dist');

Expand All @@ -14,18 +13,17 @@ module.exports = {
'\\..*': {
skipDefaultConversion: true,
transform: function (importName, matches, filename) {
const file = path.resolve(
path.dirname(filename),
`${matches[0]}.js`
);
return path
const file = path.resolve(path.dirname(filename), `${matches[0]}`);
return `/${path
.relative(
siteDir,
file.startsWith(testsDir)
? path.resolve(testsBuiltDir, path.relative(testsDir, file))
: file
process.cwd(),
resolve(
file.startsWith(testsDir)
? path.resolve(testsBuiltDir, path.relative(testsDir, file))
: file
)
)
.replaceAll('\\', '/');
.replaceAll('\\', '/')}`;
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 15e834a

Please sign in to comment.