nuxt / bridge

🌉 Experience Nuxt 3 features on existing Nuxt 2 projects
MIT License
273 stars 29 forks source link

ENOTDIR in Nuxt bridge with pinia v0.4.0+ #493

Open danielroe opened 2 years ago

danielroe commented 2 years ago

Trying to upgrade to v0.4.0 with Nuxt bridge and trying to build the application gives me:

 ERROR  Rollup error: ENOTDIR: not a directory, stat '/.../node_modules/.pnpm/pinia@2.0.20_typescript@4.7.4+vue@2.7.9/node_modules/pinia/dist/pinia.mjs/dist/pinia'

 FATAL  ENOTDIR: not a directory, stat '/.../node_modules/.pnpm/pinia@2.0.20_typescript@4.7.4+vue@2.7.9/node_modules/pinia/dist/pinia.mjs/dist/pinia'

Here you go: https://codesandbox.io/s/nuxt-pinia-evblty Run a yarn build to reproduce the error.

Originally posted by @dargmuesli in https://github.com/vuejs/pinia/discussions/1582.

dargmuesli commented 2 years ago

Upgrading @uppy/core and @uppy/tus to v3 gave me the typical missing transpilation issues in dev. Adding

      '@uppy/companion-client',
      '@uppy/core',
      '@uppy/store-default',
      '@uppy/tus',
      '@uppy/utils',
      'nanoid',

to the transpile error makes dev accessible again, but yields the following error on build:

 ERROR  Rollup error: ENOTDIR: not a directory, stat '/.../node_modules/.pnpm/node_modules/tus-js-client/lib.es5/browser/index.js/lib.es5/browser'

 FATAL  ENOTDIR: not a directory, stat '/.../node_modules/.pnpm/node_modules/tus-js-client/lib.es5/browser/index.js/lib.es5/browser'

I do have the alias 'tus-js-client': 'tus-js-client/lib.es5/browser/index.js' still set up, and it seems I cannot remove it yet. That rollup import path sounds much like the pinia issue. I'm wondering why those errors only appear under those upgrade circumstances though? :D

retroriff commented 2 years ago

Same error here with yarn generate:

Nuxt Fatal Error
Error: ENOTDIR: not a directory, stat
node_modules/pinia/dist/pinia.mjs/dist/pinia
danielroe commented 2 years ago

In this case you can work around it by adding pinia to your build.transpile array:

import { defineNuxtConfig } from '@nuxt/bridge'

export default defineNuxtConfig({
  modules: ['@pinia/nuxt'],
  build: {
    transpile: ['pinia'],
  },
})
retroriff commented 2 years ago

@danielroe That worked, thank you 👍