سعي*_*عيد 1 reactjs webpack core-js
我将 CollectionPage 的组件更改为箭头函数组件,而不仅仅是普通函数,然后出现此错误,但我不知道为什么当我对许多其他组件执行相同操作时它没有抛出此错误。这是组件代码
import { from } from 'core-js/fn/array'
import React from 'react'
import { useParams } from 'react-router-dom'
import Products from '../Products/Products'
import {H1} from '../../Style/global'
const CollectionPage=()=> {
const {collectionTitle}= useParams()
return (
<div style={{marginTop:96}}>
<H1>{collectionTitle} Collection</H1>
<Products collectionTitle={collectionTitle}/>
</div>
)
}
export default CollectionPage
Run Code Online (Sandbox Code Playgroud)
顺便说一句,这是一个 react webpack 项目,这是我的 webpack 配置:
const path = require('path')
const HTMLPlugin = require('html-webpack-plugin')
const CopyPlugin = require('copy-webpack-plugin');
module.exports ={
entry :"./src/index.js",
output:{
path:path.resolve(__dirname,"./dist"),
filename:'index.js',
},
plugins:[
new HTMLPlugin({template:'./src/index.html'}),
new CopyPlugin({
patterns: [
{ from: './src/images', to: 'images' },
],
}),
],
module:{
rules:[
{
test : /\.js$/,
exclude:/node_modules/,
use:{
loader:"babel-loader"
},
},
{
test: /\.(png|gif|jpg)$/,
include: [
path.join(__dirname, './src/images')
],
loader: 'file-loader',
},
{
test:/.(png|jpg|woff|woff2|eot|ttf|svg|gif)$/, //Customise according to your need
use: [
{
loader: 'url-loader',
options: {
limit: 100000000,
}
}
]
},
{
test: /\.js$/,
enforce: 'pre',
use: ['source-map-loader'],
},
{
test: /\.css$/i,
loader: 'style-loader!css-loader'
},
]
}
}
Run Code Online (Sandbox Code Playgroud)
这是错误:
./src/components/routes/CollectionPage.js 未找到模块:错误:无法解析 'C:\Users\Ora Ora\l-3afya-mafya-merch-store- 中的 'core-js/fn/array' react-js-\src\components\routes'
也收到这个错误
来自 chokidar (C:\node_modules) 的错误:错误:EBUSY:资源繁忙或锁定,lstat 'C:\DumpStack.log.tmp' 来自 chokidar (C:\node_modules) 的错误:错误:EBUSY:资源繁忙或锁定,lstat来自 chokidar (C:\node_modules) 的“C:\hiberfil.sys”错误:错误:EBUSY:资源繁忙或锁定,来自 chokidar (C:\node_modules) 的 lstat“C:\pagefile.sys”错误:错误:EBUSY:资源繁忙或锁定,来自 chokidar (C:\node_modules) 的 lstat 'C:\swapfile.sys' 错误:错误:EBUSY:资源繁忙或锁定,lstat 'C:\DumpStack.log.tmp' 来自 chokidar 的错误 (C: \node_modules): 错误: EBUSY: 资源繁忙或锁定, lstat 'C:\hiberfil.sys' 来自 chokidar 的错误 (C:\node_modules): 错误: EBUSY: 资源繁忙或锁定, lstat 'C:\pagefile.sys'来自 chokidar (C:\node_modules) 的错误:错误:EBUSY:资源繁忙或锁定,lstat 'C:\swapfile.sys'
感谢 Jacobo Tapia 的评论,我意识到这是一个愚蠢的 Visual Studio 自动导入错误,因为您可以在我的组件顶部看到这个import { from } from 'core-js/fn/array'没有任何意义的导入
| 归档时间: |
|
| 查看次数: |
1222 次 |
| 最近记录: |