Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve the absolute path to the current directory #266

Merged
merged 1 commit into from
Jan 16, 2020

Conversation

varl
Copy link
Contributor

@varl varl commented Jan 16, 2020

When running cli-app-scripts test in an app, the line:

extends: './app.babel.config'

Incorrectly resolves from the current working directory:

Cannot find module './app.babel.config' from '/home/varl/dev/dhis2/apps/usage-analytics'

We can use path.resolve + __dirname[1] to resolve the absolute path
of the app.babel.config.js file relatively to babel.config.js.

[1] https://nodejs.org/api/globals.html#globals_dirname

When running `cli-app-scripts test` in an app, the line:

    extends: './app.babel.config'

Incorrectly resolves from the current working directory:

    Cannot find module './app.babel.config' from '/home/varl/dev/dhis2/apps/usage-analytics'

We can use `path.resolve` + `__dirname`[1] to resolve the absolute path
of the `app.babel.config.js` file relatively to `babel.config.js`.

[1] https://nodejs.org/api/globals.html#globals_dirname
Copy link
Member

@amcgee amcgee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks!

@varl varl merged commit 190c111 into master Jan 16, 2020
@varl varl deleted the fix/app-babel-config-resolution branch January 16, 2020 10:20
dhis2-bot added a commit that referenced this pull request Jan 16, 2020
## [3.1.4](v3.1.3...v3.1.4) (2020-01-16)

### Bug Fixes

* resolve the absolute path to the current directory ([#266](#266)) ([190c111](190c111))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 3.1.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

3 participants