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

Question: Will the order of the imports in the metafile continue to match the order they appear in source code? #1388

Closed
matthewmueller opened this issue Jun 21, 2021 · 1 comment

Comments

@matthewmueller
Copy link

matthewmueller commented Jun 21, 2021

Hey there,

I'm just wondering if we can expect the order of the imports in the metafile to continue to match the order they appear in source code?

import { Component } from "react"
import uid from "../modules/uid"
import Youtube from "../modules/youtube"

Currently maps to:

{ 
  "inputs": {
    "view/index.jsx": {
      "imports": [
        "node_modules/react/index.js",
        "modules/uid/index.ts",
        "modules/youtube/index.ts"
      ]
   }
   // ... 
}

I'm currently looking to use the metafile to more quickly map ../modules/uid to it's resolved path modules/uid/index.ts. The easiest way is to use the order they appear. This probably won't be necessary once there's access to the resolver (e.g. #641 (comment))

Thanks!

@matthewmueller matthewmueller changed the title Question: Is the order of the metafile imports in the order the imports appear in the file? Question: Will the order of the imports in the metafile continue to match the order they appear in source code? Jun 21, 2021
@matthewmueller
Copy link
Author

matthewmueller commented Jun 22, 2021

Ended up going with the workaround described in this comment since this doesn't account for imports getting added by plugins and is generally pretty fragile.

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

1 participant