Skip to content

Vite 3.1 requires stripping query string from paths #51

Closed

Description

@martinpengellyphillips

In some cases, running a project with vite 3.1 now causes an error. E.g.

21:57:35 [vite] Internal server error: Failed to parse source for import analysis because the content contains invalid JS syntax. If you are using JSX, make sure to name the file with the .jsx or .tsx extension.
  Plugin: vite:import-analysis
  File: C:/Users/martin/data/identities/personal/project/solid-dnd-site/node_modules/@thisbeyond/solid-dnd/dist/source/sortable-context.jsx?v=a83c0c67
  39 |      return <Context.Provider value={context}>{props.children}</Context.Provider>;
  40 |  };
  41 |  const useSortableContext = () => {
     |                                    ^
  42 |      return useContext(Context) || null;
  43 |  };
      at formatError (file:///C:/Users/martin/data/identities/personal/project/solid-dnd-site/node_modules/vite/dist/node/chunks/dep-665b0112.js:40782:46)
      at TransformContext.error (file:///C:/Users/martin/data/identities/personal/project/solid-dnd-site/node_modules/vite/dist/node/chunks/dep-665b0112.js:40778:19)
      at TransformContext.transform (file:///C:/Users/martin/data/identities/personal/project/solid-dnd-site/node_modules/vite/dist/node/chunks/dep-665b0112.js:37449:22)
      at async Object.transform (file:///C:/Users/martin/data/identities/personal/project/solid-dnd-site/node_modules/vite/dist/node/chunks/dep-665b0112.js:41031:30)
      at async loadAndTransform (file:///C:/Users/martin/data/identities/personal/project/solid-dnd-site/node_modules/vite/dist/node/chunks/dep-665b0112.js:37292:29)

I reported issue to vite and they responded that this needs to be fixed in vite-plugin-solid: vitejs/vite#10087 (comment)

Activity

  1. martinpengellyphillips commented on Sep 13, 2022

    @martinpengellyphillips
    ContributorAuthor

    I'll open a pr to test proposed fix.

  2. martinpengellyphillips commented on Sep 13, 2022

    @martinpengellyphillips
    ContributorAuthor

    I applied the proposed fix in a local copy of the plugin and it cleared the vite error, but then my app would fail with a console error that intermediate value was underfined for some imports. I tried a few things, but couldn't figure out how to address that, but it did seem to be related to .ts files in my solid-dnd package.

    So I tried reverting back to the standard plugin and converting all my solid-dnd package to .tsx and linking that in. That then worked without error.

    It seems like some bug with packages containing a mix of .ts and .tsx. But I'm stumped now on where the fix should be (in vite-plugin-solid or vite).

  3. added a commit that references this issue on Sep 15, 2022
    4334fa9
  4. added a commit that references this issue on Sep 15, 2022
    d343336
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