Error Module FS Cannot Resolved on NextJS #5861
Unanswered
fwidjaya20
asked this question in
Q&A
Replies: 3 comments
-
this only can be reproduce if i build my own lib using rollup, when i switch it using Here's my rollup.config import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import resolve from '@rollup/plugin-node-resolve'
import terser from '@rollup/plugin-terser'
import typescript from '@rollup/plugin-typescript'
import { defineConfig } from 'rollup'
import peerDepsExternal from 'rollup-plugin-peer-deps-external'
import { visualizer } from 'rollup-plugin-visualizer'
import packageJson from './package.json' assert { type: 'json' }
export default defineConfig([
{
input: 'src/index.ts',
output: {
dir: 'dist',
format: 'esm',
preserveModules: true,
preserveModulesRoot: 'src',
sourcemap: true,
entryFileNames: (chunkInfo) => {
if (chunkInfo.name.includes('node_modules')) {
return chunkInfo.name.replace('node_modules', 'external') + '.js'
}
return '[name].js'
},
},
plugins: [
peerDepsExternal(),
resolve({
exportConditions: ['node'],
}),
json(),
commonjs(),
typescript({
tsconfig: './tsconfig.json',
declaration: true,
declarationDir: 'dist',
}),
terser(),
visualizer({
filename: 'bundle-analysis.html',
open: false,
}),
],
external: [...Object.keys(packageJson.peerDependencies || {})],
treeshake: true,
},
]) |
Beta Was this translation helpful? Give feedback.
0 replies
-
hi @fwidjaya20 I have the same problem with you. After spending hours investigating, I figured out that Axios tries to use |
Beta Was this translation helpful? Give feedback.
0 replies
-
Sorry, borther here, can you try xior? https://github.com/suhaotian/xior
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the issue
I Wrapped Axios library in my own library, and I found this error while install it in NextJS Project.
Can you help me figure it out what wrong ?
Example Code
No response
Expected behavior
No response
Axios Version
1.4.0
Adapter Version
No response
Browser
Chrome
Browser Version
No response
Node.js Version
18.13.0
OS
No response
Additional Library Versions
No response
Additional context/Screenshots
No response
Beta Was this translation helpful? Give feedback.
All reactions