Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion lib/relative-module-paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,28 @@ function getRelativeModulePath(modulePath) {
return ensurePosix(path.relative(process.cwd(), modulePath));
}

/**
* This function is used in babel-plugin-module-resolver,
* which is configured in lib/babel-options-util and lib/ember-plugins.
*
* By default, babel-plugin-module-resolver handles extensions,
* and by default will strip extensions.
*
* However, we opted out of that when we passed `resolvePath`
* to the plugin.
* So now we have to strip extensions ourselves.
*
* This came up in https://github.com/emberjs/ember-cli-babel/pull/530
* because until more recent(ish) versions of node, commonjs requires would not specify the extension.
* _so we got lucky_.
*/
function resolveRelativeModulePath(name, child) {
return moduleResolve(name, getRelativeModulePath(child));
let relativeModulePath = getRelativeModulePath(child);
let resolved = moduleResolve(name, relativeModulePath);

// AMD / loader.js does not support extensions
// (the result of this goes right into AMD's define(here, [....]))
return resolved.replace(/\.js$/, '');
}

module.exports = {
Expand Down
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@
"test:node:debug": "mocha debug node-tests"
},
"dependencies": {
"@babel/helper-compilation-targets": "^7.20.7",
"@babel/plugin-proposal-decorators": "^7.20.13",
"@babel/plugin-transform-class-properties": "^7.16.5",
"@babel/plugin-transform-class-static-block": "^7.22.11",
"@babel/plugin-transform-modules-amd": "^7.20.11",
"@babel/plugin-transform-private-methods": "^7.16.5",
"@babel/plugin-transform-private-property-in-object": "^7.20.5",
"@babel/plugin-transform-runtime": "^7.13.9",
"@babel/plugin-transform-typescript": "^7.20.13",
"@babel/preset-env": "^7.20.2",
"@babel/runtime": "7.12.18",
"@babel/helper-compilation-targets": "^7.28.6",
"@babel/plugin-proposal-decorators": "^7.29.0",
"@babel/plugin-transform-class-properties": "^7.28.6",
"@babel/plugin-transform-class-static-block": "^7.28.6",
"@babel/plugin-transform-modules-amd": "^7.27.1",
"@babel/plugin-transform-private-methods": "^7.28.6",
"@babel/plugin-transform-private-property-in-object": "^7.28.6",
"@babel/plugin-transform-runtime": "^7.29.0",
"@babel/plugin-transform-typescript": "^7.28.6",
"@babel/preset-env": "^7.29.0",
"@babel/runtime": "^7.28.6",
"amd-name-resolver": "^1.3.1",
"babel-plugin-debug-macros": "^0.3.4",
"babel-plugin-debug-macros": "^2.0.0",
"babel-plugin-ember-data-packages-polyfill": "^0.1.2",
"babel-plugin-ember-modules-api-polyfill": "^3.5.0",
"babel-plugin-module-resolver": "^5.0.0",
Expand All @@ -69,7 +69,7 @@
"semver": "^7.3.8"
},
"devDependencies": {
"@babel/core": "^7.22.10",
"@babel/core": "^7.29.0",
"@ember/optional-features": "^2.0.0",
"@ember/string": "^3.1.1",
"@ember/test-helpers": "^3.2.0",
Expand Down
Loading