支付宝小程序报错:“Failed to compile”怎么解决!

文章描述:

支付宝小程序在允许的时候报错:“Failed to compile”

Failed to compile

Please set enableNodeModuleBabelTransform to true in mini.project.json for node_modules babel transform: Invalid regular expression flag (91:22)
37: const propertyDelimiterRE = /:([^]+)/;
38:-> const styleCommentRE = /\/\*.*?\*\//gs;
39: function parseStringStyle(cssText) {

 

解决方案

网址:https://help.aliyun.com/document_detail/444395.html

1、检查是否填写支付宝appid

2、项目根目录运行以下命令:

npm install --save @alicloud/mpserverless-sdk

2、打开mini.project.json文件,把以下

{
  "component2": true,
  "enableAppxNg": true,
  "enableNodeModuleBabelTransform": true
}

改成

{
    "enableNodeModuleBabelTransform": true,
    "node_modules_es6_whitelist": [ 
        "@alicloud/mpserverless-sdk"
    ]
}

或者

{
	"component2": true,
	"enableAppxNg": false,
        "enableNodeModuleBabelTransform": true,
        "node_modules_es6_whitelist": [ 
        "@alicloud/mpserverless-sdk"
    ]
	
}

 

发布时间:2022/12/13

发表评论