babel / babel/babel-loader

Access Resource Query in Plugins?

Open
#916 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4.8k
Forks
456
Avg merge
9h 19m
Merged PRs (30d)
2

Description

Especially when files contain javascript and css it might be necessary to process the file twice.
One time for javascript and one time for css.

Is there any way to access the webpack resource query inside a babel plugin?

For example here:

```js
import { foo } from "./demo?extractOnlyCss"
import { bar } from "./demo"
```

Could a babel plugin process `./demo` twice and know about `?extractOnlyCss`?

Contributor guide

Open the contributing guide

Research direction

Begin by investigating how babel-loader passes webpack resource queries into Babel plugins, using the two example imports as the reproduction. Done means establishing whether the same module can be processed twice with the query exposed, and documenting or implementing the supported behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, webpack
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.