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

build with nuxt3 not find tslib #516

Open
NaCoLiu opened this issue Jun 20, 2023 · 12 comments
Open

build with nuxt3 not find tslib #516

NaCoLiu opened this issue Jun 20, 2023 · 12 comments
Labels

Comments

@NaCoLiu
Copy link

NaCoLiu commented Jun 20, 2023

Environment

Nuxi 3.5.3                                                                                                                    7:32:45 PM
                                                                                                                              7:32:45 PM
RootDir: /Users/naco/Documents/retain                                                                                         7:32:45 PM
Nuxt project info: (copied to clipboard)                                                                                      7:32:45 PM

------------------------------
- Operating System: Darwin
- Node Version:     v18.16.0
- Nuxt Version:     3.5.3
- Nitro Version:    2.4.1
- Package Manager:  pnpm@8.6.3
- Builder:          vite
- User Config:      app, devtools, srcDir, modules, imports, pinia, alias, apollo
- Runtime Modules:  @nuxtjs/apollo@5.0.0-alpha.6, @pinia/nuxt@0.4.11
- Build Modules:    -
------------------------------

👉 Report an issue: https://github.com/nuxt/nuxt/issues/new                                                                   7:32:45 PM

👉 Suggest an improvement: https://github.com/nuxt/nuxt/discussions/new

👉 Read documentation: https://nuxt.com

Describe the bug

naco@NaCo retain % node .output/server/index.mjs    
Listening http://[::]:3000
[nuxt] [request error] [unhandled] [500] Cannot find module '/Users/naco/Documents/retain/.output/server/node_modules/tslib/modules/index.js' imported from /Users/naco/Documents/retain/.output/server/chunks/app/server.mjs
Did you mean to import tslib/tslib.js?
  at new NodeError (node:internal/errors:399:5)  
  at finalizeResolution (node:internal/modules/esm/resolve:326:11)  
  at moduleResolve (node:internal/modules/esm/resolve:945:10)  
  at defaultResolve (node:internal/modules/esm/resolve:1153:11)  
  at nextResolve (node:internal/modules/esm/loader:163:28)  
  at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)  
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)  
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)  
  at link (node:internal/modules/esm/module_job:76:36)

Expected behaviour

nuxt.config.ts

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  app: {
    head: {
      charset: 'utf-8',
      viewport: 'width=device-width, initial-scale=1',
    }
  },
  devtools: { enabled: true },
  srcDir:"./src",
  modules: ['@nuxtjs/apollo','@pinia/nuxt'],
  imports: {
    dirs: ['./store'],
  },
  pinia: {
    autoImports: ['defineStore', 'acceptHMRUpdate','storeToRefs'],
  },
  alias: {
    tslib: 'tslib'
  },
  apollo: {
    clients: {
      default: {
        httpEndpoint: 'https://api.nco.im/graphql'
      }
    },
  },
})

Reproduction

No response

Additional context

No response

Logs

No response

@NaCoLiu NaCoLiu added the bug label Jun 20, 2023
@NaCoLiu NaCoLiu changed the title build with nuxt3 not find tslinb build with nuxt3 not find tslib Jun 20, 2023
@slavanossar
Copy link
Contributor

Likely due to this change to tslib exports, you can override the version to one that works

PNPM

{
 "pnpm": {
    "overrides": {
      "tslib": "2.5.1"
    }
  }
}

Yarn

{
  "resolutions": {
    "tslib": "2.5.1"
  }
}

@NaCoLiu
Copy link
Author

NaCoLiu commented Jun 20, 2023

@slavanossar thx bro.

@NaCoLiu NaCoLiu closed this as completed Jun 20, 2023
@slavanossar
Copy link
Contributor

slavanossar commented Jun 20, 2023

@NaCoLiu I think leave this issue open, this module might need to be updated to use new exports from tslib so the issue needs to be tracked

@NaCoLiu NaCoLiu reopened this Jun 20, 2023
@oosame
Copy link

oosame commented Jun 22, 2023

@slavanossar any resolution for npm?

@slavanossar
Copy link
Contributor

@oosame you can try pinning the version by adding the required version as a dependency

npm install tslib@2.5.1 --save-dev

@markhacd
Copy link

@oosame you can try pinning the version by adding the required version as a dependency

npm install tslib@2.5.1 --save-dev

thx bro.

@FamilyMan
Copy link

Also need to check that package.json has "type": "module"

@iamandrewluca
Copy link

@slavanossar any resolution for npm?

{
	"overrides": {
		"tslib": "2.5.1"
	}
}

@Sina-Afsharmanesh
Copy link

Any updates on this? It'd be nice if this gets fixed in v5 and we could use the latest version tslib, since some other libraries need it.

@iamandrewluca
Copy link

@Sina-Afsharmanesh check one of these solutions. Both should work.

nuxt/nuxt#19265 (comment)

@Xanndr-exe
Copy link

Xanndr-exe commented Nov 29, 2023

just add to nuxt config

 build: {
    transpile: ['tslib']
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants