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

Transform hook run before load hook on webpack #324

Open
jzymx50 opened this issue Jul 25, 2023 · 2 comments
Open

Transform hook run before load hook on webpack #324

jzymx50 opened this issue Jul 25, 2023 · 2 comments

Comments

@jzymx50
Copy link

jzymx50 commented Jul 25, 2023

Environment

"unplugin": "^1.4.0",
"webpack": "^5.88.2",

Reproduction

const unplugin = createUnplugin((options) => {
  return {
    name: 'test',
    load(id) {
      console.log(id,'load hook')
      return null
    },
    transform() {
      console.log('transform hook')
      return null
    },
    buildStart() {
      console.log('build start hook')
    }
  }
})

The console outputs are:

build start hook
transform hook
C:\xxx\src\index.js load hook

Describe the bug

From the source code, I found out the transform hook was handled before the load hook. And unshift() was used to put the generated loader into the webpack config. Should the load hook be handled earlier than the transform hook?

Additional context

No response

Logs

No response

@qiYuei
Copy link
Contributor

qiYuei commented Aug 1, 2023

I have the same question, can you tell me the answer ? please @antfu @sxzz

@sxzz
Copy link
Collaborator

sxzz commented Aug 1, 2023

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

3 participants