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

Relative same folder glob selector is not evaluated correctly #369

Open
JakubHlousek opened this issue Aug 3, 2022 · 0 comments
Open

Relative same folder glob selector is not evaluated correctly #369

JakubHlousek opened this issue Aug 3, 2022 · 0 comments

Comments

@JakubHlousek
Copy link

Environment

  • OS Version: Windows 10 Home (21H2)
  • Node.js Version: 8.15.1

Actual behaviour

When using a glob import syntax starting with ./ the relative path gets evaluated incorrectly

Example folder structure:
├── themes
│ ├── dark.theme.json
│ ├── light.theme.json
│ ├── contrast.theme.json
│ └── Themes.js <-- relative import from here
└── index.js

the following import

import * as ThemeObjects from "./*.theme.json

gets evaluated into

import * as module0 from 'dark.theme.json'
import * as module1 from 'light.theme.json'"
import * as module2 from 'contrast.theme.json'

which incorrectly refers to the root directory resulting in a crash

Expected behaviour

the mentioned import should get evaluated into:

import * as module0 from './dark.theme.json'
import * as module1 from './light.theme.json'"
import * as module2 from './contrast.theme.json'

Steps to reproduce

Use a relative import to refer to contents in the same folder

Possible fix

After inspecting the source files I discovered a possible culprit:

const basePath = task.base === '.' ? '' : task.base;

The conditional statement on this line destroys otherwise perfectly working import. Is this the intended behaviour?

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

No branches or pull requests

2 participants