Skip to content

Transform hook run before load hook on webpack #324

Description

@jzymx50

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions