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

When using axios in Rollup bundle throwing error Module not found: Error: Can't resolve '../adapters/http' and etc #4865

Closed
PK-Saravanan opened this issue Jul 19, 2022 · 2 comments

Comments

@PK-Saravanan
Copy link

Section/Content To Improve

I have used axios in roolup bundled app and I'm getting error while consuming exposed app with axios.

Suggested Improvement

Compiled with problems:X

ERROR in ./node_modules/msal-auth/lib/index.esm.js 20948:14-33
Module not found: Error: Can't resolve '../utils' in 'C:\msal-auth\lib'
ERROR in ./node_modules/msal-auth/lib/index.esm.js 20950:26-67
Module not found: Error: Can't resolve '../helpers/normalizeHeaderName' in 'C:\msal-auth\lib'
ERROR in ./node_modules/msal-auth/lib/index.esm.js 20952:19-50
Module not found: Error: Can't resolve '../core/enhanceError' in 'C:\msal-auth\lib'
ERROR in ./node_modules/msal-auth/lib/index.esm.js 20954:27-52
Module not found: Error: Can't resolve './transitional' in 'C:\msal-auth\lib'
ERROR in ./node_modules/msal-auth/lib/index.esm.js 20971:14-40
Module not found: Error: Can't resolve '../adapters/xhr' in 'C:\msal-auth\lib'
ERROR in ./node_modules/msal-auth/lib/index.esm.js 20974:14-41
Module not found: Error: Can't resolve '../adapters/http' in 'C:\msal-auth\lib'

Relevant File(s)

Rollup.config.js
import peerDepsExternal from "rollup-plugin-peer-deps-external";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";

import typescript from "rollup-plugin-typescript2";
import css from "rollup-plugin-import-css";
import json from "@rollup/plugin-json";
// import nodePolyfills from 'rollup-plugin-node-polyfills';
import nodePolyfills from 'rollup-plugin-polyfill-node';
import { babel } from '@rollup/plugin-babel';
const packageJson = require("./package.json");

export default {
input: "src/index.tsx",
external: [
"prop-types",
"react-is"
],
output: [
{
file: packageJson.main,
format: "cjs",
sourcemap: true
},
{
file: packageJson.module,
format: "esm",
sourcemap: true
}
],
plugins: [
nodePolyfills(),
// nodePolyfills({include:null}),
peerDepsExternal(),
babel({ //disabled cause WebComponent integration
presets: ["@babel/preset-react"],
exclude: 'node_modules/**',
babelHelpers: 'bundled'
}),
commonjs(),
typescript({ useTsconfigDeclarationDir: true }),
css(),
json(),
resolve()
]
};

Environment

  • Axios Version [^0.27.2]
@zackarydev
Copy link

+1 here

@jasonsaayman
Copy link
Member

this should be fixed, please try with the latest version, should you get the same behaviour please open a new isue

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

No branches or pull requests

3 participants