【发布时间】:2020-09-05 15:59:17
【问题描述】:
我按照 symfony 文档在我的项目中启用 webpack encore:https://symfony.com/doc/5.1/frontend/encore/installation.html
我发出的命令:
> brew install node
> npm install -g yarn
> cd ~/path/to/project
> yarn set version berry
> composer require symfony/webpack-encore-bundle
> yarn install
尽管yarn install 产生了一些关于未能构建某些包的警告,但它们都成功运行。
之后我执行yarn encore dev 时出现以下错误:
ERROR Failed to compile with 1 errors 3:09:15 PM
error in ./assets/js/app.js
Syntax Error: Error: Cannot find module '@babel/plugin-syntax-dynamic-import' from '~/path/to/project'
at Array.map (<anonymous>)
at cachedFunction.next (<anonymous>)
at Generator.next (<anonymous>)
at buildRootChain.next (<anonymous>)
at loadPrivatePartialConfig.next (<anonymous>)
at Generator.next (<anonymous>)
at Generator.next (<anonymous>)
at new Promise (<anonymous>)
谷歌搜索只让我发现了一些 github 问题,这些问题似乎与从 babel 6 到 7 的切换有关,但正如我所做的全新安装,似乎没有连接。
附加信息:
- 操作系统:macOS 10.15.6
- 节点版本:v14.9.0
【问题讨论】:
标签: symfony yarnpkg webpack-encore