micro-dev
micro-dev copied to clipboard
micro-dev and .mjs "experimental-modules"
I'm trying to get micro-dev working with my .mjs files.
I tried the proposed solution in this closed issue but it throws an error and I'm unsure of a workaround.
"dev": "node --experimental-modules node_modules/.bin/micro-dev index.mjs"
Produces the following error:
micro: Error when importing
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module
I've been using micro-dev with the esm package just fine
"scripts": {
"start": "node -r esm ./node_modules/.bin/micro src/index.js",
"dev": "node -r esm ./node_modules/.bin/micro-dev src/index.js"
},
"dependencies": {
"micro": "^9.3.3",
"esm": "^3.0.84"
},
"devDependencies": {
"micro-dev": "^3.0.0"
}
It's probably not as fast as built in experimental modules, but maybe it'll help you get where you need to be
You can fix this after accepting PR to micro: https://github.com/vercel/micro/pull/448 or now with using npm i -D es-micro-dev