plasmicapp / plasmic

Visual builder for React. Build apps, websites, and content. Integrate with your codebase.
https://www.plasmic.app
MIT License
4.69k stars 377 forks source link

[Codegen] - Module not found: Can't resolve path error #79

Closed neko1101 closed 6 months ago

neko1101 commented 1 year ago

Hi Plasmic Team,

I found a mild bug on when using path parameter.

The path generated is not accurate when we use nested path.

Vercel build log as below:

[22:51:21.123] info  - Creating an optimized production build...
[22:51:27.904] Failed to compile.
[22:51:27.905] 
[22:51:27.905] ./components/plasmic/redacted/PlasmicOrderSummary.jsx
[22:51:27.905] Module not found: Can't resolve '../../OrderItemTable'
[22:51:27.905] 
[22:51:27.905] https://nextjs.org/docs/messages/module-not-found
[22:51:27.905] 
[22:51:27.905] Import trace for requested module:
[22:51:27.905] ./pages/order-summary.jsx
[22:51:27.906] 
[22:51:27.906] ./pages/admin-order-view/[order_id].jsx
[22:51:27.906] Module not found: Can't resolve '../components/plasmic/redacted/PlasmicAdminOrderView'
[22:51:27.906] 
[22:51:27.906] https://nextjs.org/docs/messages/module-not-found
[22:51:27.906] 
[22:51:27.906] ./pages/order/[customerName]/[customerPhone].jsx
[22:51:27.907] Module not found: Can't resolve '../components/plasmic/redacted/PlasmicOrder'
[22:51:27.907] 
[22:51:27.907] https://nextjs.org/docs/messages/module-not-found
[22:51:27.907] 
[22:51:27.907] ./pages/thank-you/[customerName]/[customerPhone].jsx
[22:51:27.907] Module not found: Can't resolve '../components/plasmic/redacted/PlasmicThankYou'
[22:51:27.907] 
[22:51:27.907] https://nextjs.org/docs/messages/module-not-found
[22:51:27.909] 
[22:51:27.909] 
[22:51:27.909] > Build failed because of webpack errors
[22:51:27.956] Error: Command "npm run build" exited with 1
[22:51:28.193] BUILD_UTILS_SPAWN_1: Command "npm run build" exited with 1

Currently, i manage to solve it by manually updating the correct path.

yang commented 1 year ago

Hi, note that the import paths are relative to the source directory rather than say the base path of the project, can you check that these are correct in your json config?

On Tue, Apr 4, 2023, 7:58 AM Neko @.***> wrote:

Hi Plasmic Team,

I found a mild bug on when using path parameter.

The path generated is not accurate when we use nested path.

Vercel build log as below:

[22:51:21.123] info - Creating an optimized production build... [22:51:27.904] Failed to compile. [22:51:27.905] [22:51:27.905] ./components/plasmic/redacted/PlasmicOrderSummary.jsx [22:51:27.905] Module not found: Can't resolve '../../OrderItemTable' [22:51:27.905] [22:51:27.905] https://nextjs.org/docs/messages/module-not-found [22:51:27.905] [22:51:27.905] Import trace for requested module: [22:51:27.905] ./pages/order-summary.jsx [22:51:27.906] [22:51:27.906] ./pages/admin-order-view/[order_id].jsx [22:51:27.906] Module not found: Can't resolve '../components/plasmic/redacted/PlasmicAdminOrderView' [22:51:27.906] [22:51:27.906] https://nextjs.org/docs/messages/module-not-found [22:51:27.906] [22:51:27.906] ./pages/order/[customerName]/[customerPhone].jsx [22:51:27.907] Module not found: Can't resolve '../components/plasmic/redacted/PlasmicOrder' [22:51:27.907] [22:51:27.907] https://nextjs.org/docs/messages/module-not-found [22:51:27.907] [22:51:27.907] ./pages/thank-you/[customerName]/[customerPhone].jsx [22:51:27.907] Module not found: Can't resolve '../components/plasmic/redacted/PlasmicThankYou' [22:51:27.907] [22:51:27.907] https://nextjs.org/docs/messages/module-not-found [22:51:27.909] [22:51:27.909] [22:51:27.909] > Build failed because of webpack errors [22:51:27.956] Error: Command "npm run build" exited with 1 [22:51:28.193] BUILD_UTILS_SPAWN_1: Command "npm run build" exited with 1

Currently, i manage to solve it by manually updating the correct path.

— Reply to this email directly, view it on GitHub https://github.com/plasmicapp/plasmic/issues/79, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABXWI2NWSCGGD43RQUAOLW7QZJDANCNFSM6AAAAAAWS2YUOU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

neko1101 commented 1 year ago

@yang

did you mean jsconfig.json?

{
  "compilerOptions": {
    "paths": {
      "@/*": ["./*"]
    }
  }
}
yang commented 1 year ago

Sorry no I mean in your plasmic.json

On Tue, Apr 4, 2023, 9:45 PM Neko @.***> wrote:

@yang https://github.com/yang

did you mean jsconfig.json?

{ "compilerOptions": { "paths": { "@/": ["./"] } } }

— Reply to this email directly, view it on GitHub https://github.com/plasmicapp/plasmic/issues/79#issuecomment-1496910440, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABXWNRDJDY6AM6NZVFGI3W7T2E7ANCNFSM6AAAAAAWS2YUOU . You are receiving this because you were mentioned.Message ID: @.***>

neko1101 commented 1 year ago

Here you go:

eg for PlasmicAdminOrderView

{
        "id": "redacted",
        "name": "AdminOrderView",
        "type": "managed",
        "projectId": "redacted",
        "renderModuleFilePath": "plasmic/redacted/PlasmicAdminOrderView.jsx",
        "importSpec": {
          "modulePath": "../pages/admin-order-view/[order_id].jsx"
        },
        "cssFilePath": "plasmic/redacted/PlasmicAdminOrderView.module.css",
        "scheme": "blackbox",
        "componentType": "page"
}
yang commented 1 year ago

Do things work if you try syncing things into a brand new create-plasmic-app with next.js and codegen?

If that does not work, then let us know the project ID, and we can take a look.

On Tue, Apr 4, 2023 at 11:20 PM Neko @.***> wrote:

Here you go:

eg for PlasmicAdminOrderView

{ "id": "redacted", "name": "AdminOrderView", "type": "managed", "projectId": "redacted", "renderModuleFilePath": "plasmic/redacted/PlasmicAdminOrderView.jsx", "importSpec": { "modulePath": "../pages/admin-order-view/[order_id].jsx" }, "cssFilePath": "plasmic/redacted/PlasmicAdminOrderView.module.css", "scheme": "blackbox", "componentType": "page" }

— Reply to this email directly, view it on GitHub https://github.com/plasmicapp/plasmic/issues/79#issuecomment-1496977296, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABXWOOM3ZYNJGDI5ETYPDW7UFKNANCNFSM6AAAAAAWS2YUOU . You are receiving this because you were mentioned.Message ID: @.***>