出现错误:
如果要包括多边形填充,则需要:- 添加回退'resolve.回退:{“path”:require.resolve(“path-browserify”)}' - install 'path-browserify'如果您不想包含多边形填充,可以使用如下的空模块:resolve.fallback:{“路径”:假}
Package.Json:
"dependencies": {
"path-browserify": "^1.0.1",
//...
},
"scripts": {
"contracts:compile:abi": "typechain --target ethers-v5 --out-dir src/abis/types \"./src/abis/**/*.json\"",
"start": "craco start",
"build": "craco build",
"test": "craco test --coverage"
}
我没有一个webpack.config
,我也没有使用react-rewired-scripts
,我认为Craco
做了类似的事情,但TBH我不完全理解。
这是我的craco.config.js
module.exports = {
babel: {
plugins: ['@vanilla-extract/babel-plugin'],
},
webpack: {
plugins: [
new VanillaExtractPlugin(),
new DefinePlugin({
'process.env.REACT_APP_GIT_COMMIT_HASH': JSON.stringify(commitHash.toString()),
}),
],
configure: (webpackConfig) => {
const instanceOfMiniCssExtractPlugin = webpackConfig.plugins.find(
(plugin) => plugin instanceof MiniCssExtractPlugin
)
if (instanceOfMiniCssExtractPlugin !== undefined) instanceOfMiniCssExtractPlugin.options.ignoreOrder = true
return webpackConfig
},
},
}
如何在此处添加多边形填充?
1条答案
按热度按时间xu3bshqb1#
为了解决这个问题,我在configure方法中添加了fallback选项: