我正在尝试使用patch-package对我安装的节点包进行一些样式更改,为此,我必须使用webpack编译src/目录中的代码,以获得dist/目录中的新代码。当我运行npx webpack时,我得到了以下错误:
ERROR in ./src/index.js 189:12
Module parse failed: Unexpected token (189:12)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| render() {
| return (
> <div>我提醒您,这个node包开箱即用。我不确定我错过了什么。除了默认配置文件外,该软件包不附带任何配置文件。下面是里面的内容:
rules: [
{
test: /\.js$/,
include: path.resolve(__dirname, 'src'),
exclude: /(node_modules|bower_components|build)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
},提前感谢!
编辑:删除node_modules & package-lock并重新安装并不能解决问题
发布于 2021-03-31 09:57:15
清理node_modules并重新安装软件包可能会有所帮助。
https://stackoverflow.com/questions/66880606
复制相似问题