marko-js / marko

A declarative, HTML-based language that makes building web apps fun

Home Page:https://markojs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error running marko with @babel/preset-env@7.17.12

MiloCasagrande opened this issue · comments

Version: 5.21.1

Details

After upgrading my local dependencies to @babel/preset-env@7.17.12 when running a build/run process, @marko/webpack reports the following error:

  Module build failed (from ./node_modules/@marko/webpack/dist/loader/index.js):
  Error: Cannot find module '@babel/types/lib/builders/builder'

  Require stack:
  - /node_modules/@marko/compiler/dist/babel-types/types/patch.js
  - /node_modules/@marko/compiler/dist/babel-types/index.js
  - /node_modules/@marko/compiler/dist/index.js
  - /node_modules/@marko/webpack/dist/loader/index.js
  - /node_modules/webpack/lib/ProgressPlugin.js
  - /node_modules/webpack/lib/index.js
  - /node_modules/webpack-cli/lib/webpack-cli.js
  - /node_modules/webpack-cli/lib/bootstrap.js
  - /node_modules/webpack-cli/bin/cli.js
  - /node_modules/webpack/bin/webpack.js
      at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
      at Function.Module._load (node:internal/modules/cjs/loader:778:27)
      at Module.require (node:internal/modules/cjs/loader:1005:19)
      at require (node:internal/modules/cjs/helpers:102:18)

Looks like this commit 181b2811d788347e8516c1ecffa93260ce54a529 in @babel/types removed the required file.

The default behaviour of npm is to dedupe the package tree, resulting in a marko tree like:

└─┬ marko@5.21.1
  └─┬ @marko/compiler@5.21.1
    └── @babel/types@7.17.12 deduped

Possible Workaround

Install/Update the @babel/preset-env using the --legacy-bundling option:

npm i --legacy-bundling -D @babel/preset-env

@MiloCasagrande can you try upgrading Marko? There was a patch to resolve this

I just ran npm --force outdated but I don't see an updated version of marko available. Which version would that be?

Thanks, that solved the issue.