Hi there! 👋
I'm running into an issue where importing a module, that then imports an aliased dependency, throws an error. I'm not sure if this is an issue with this project or the upstream Microbundle.
Logs
npm run dev
npm run dev
> micro@1.0.0 dev /Users/JHAMILTON/work/micro
> microenvi --alias react=preact-compat,react-dom=preact-compat
microenvi running on: 3000
node-resolve: setting options.module is deprecated, please override options.mainFields instead
node-resolve: setting options.jsnext is deprecated, please override options.mainFields instead
Watching source, compiling to public/scripts:
Error: Could not load preact-compat (imported by /Users/JHAMILTON/work/micro/node_modules/@material-ui/core/esm/styles/useTheme.js): ENOENT: no such file or directory, open 'preact-compat'
at /Users/JHAMILTON/work/micro/node_modules/rollup/dist/rollup.js:21723:19
at async Promise.all (index 1)
at async Promise.all (index 8)
at async Promise.all (index 0)
at async Promise.all (index 0)
Reproduction
- Install dependencies
npm init --yes
npm install --save-dev microbundle microenvi preact preact-compat @material-ui/core
- Update the
package.json with a new main and a script to run microenvi.
{
"main": "public/scripts/bundle.mjs",
"scripts": {
"dev": "microenvi --alias react=preact-compat,react-dom=preact-compat"
}
}
- Create html file
public/index.html.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Hello World</title>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
/>
</head>
<body>
<div id="root"></div>
</body>
</html>
- Create js entry file
src/index.js.
import { createMuiTheme } from "@material-ui/core/styles";
const theme = createMuiTheme({});
- Run Microenvi.
Hi there! 👋
I'm running into an issue where importing a module, that then imports an aliased dependency, throws an error. I'm not sure if this is an issue with this project or the upstream Microbundle.
Logs
npm run dev
Reproduction
package.jsonwith a newmainand a script to run microenvi.{ "main": "public/scripts/bundle.mjs", "scripts": { "dev": "microenvi --alias react=preact-compat,react-dom=preact-compat" } }public/index.html.src/index.js.