我学习yalc并做它说的完全正确的事情,但是当我更改了yalc publish
上的库代码时,我在我的应用程序中看不到代码的变化。
图书馆是通知栈
步骤:
yalc link notistack
中运行yalc link notistack
然后,当我更改通知堆栈代码并运行yalc push
时,什么都不会发生,但文档说我应该在我的应用程序中得到代码更改?
我甚至重新启动App并执行yalc update notistack
,但是通知堆栈代码更改是不可见的。
奇怪的是,在我的应用程序VSCode node_modules中,我看到了notistack
代码的变化。这就像yalc push
正在向应用程序传播通知堆栈更改,但是应用程序没有使用它们。
更奇怪的是,当我重新启动VSCode并启动App进行调试时,仍然使用旧的通知堆栈代码。
我测试删除yalc remove notistack
并重新启动膝上型计算机,然后再执行yalc add notistack
。然后我又看到了旧代码。
我尝试在Chrome浏览器做硬复位空现金,但没有运气,使这个工作。
当我去yalc商店看看: C:\Users\user\AppData\Local\Yalc\packages\notistack\1.0.10\src:
我看到最新的密码了。
在Chrome检查控制台中,我看到了旧代码,但在检查器源代码下,有正确的代码。太让人困惑了。我也不能在检查器或VSCode中设置通知堆栈中的断点。就像JavaScript文件被错位了一样。
在Edge和Chrome中都会发生这种情况。
两天后我要做什么才能继续工作,我必须删除Yalc存储文件夹,C:\Users\user\AppData\Local\Yalc\packages\noti...............。应用程序项目删除包中删除的yalc.lock -lock.json和node_modules
然后重新发布和添加通知堆栈。这很费时,但很管用。
如何在Yalc中显示代码更改?
通知堆栈的package.json
{
"name": "notistack",
"version": "1.0.10",
"description": "Highly customizable notification snackbars (toasts) that can be stacked on top of each other",
"main": "src/index.js",
"module": "dist/notistack.esm.js",
"types": "src/index.d.ts",
"license": "MIT",
"author": {
"name": "Hossein Dehnokhalaji",
"email": "hossein.dehnavi98@yahoo.com",
"url": "https://github.com/iamhosseindhv/notistack"
},
"homepage": "https://www.iamhosseindhv.com/notistack",
"repository": {
"url": "git+https://github.com/iamhosseindhv/notistack.git",
"type": "git"
},
"scripts": {
"build": "tsdx build --transpileOnly --entry ./src/index.js",
"prebuild": "npm run docs",
"prepublishOnly": "npm run build",
"docs": "rimraf typedoc.json && typedoc --tsconfig",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
},
"peerDependencies": {
"@material-ui/core": "^4.0.0",
"react": "^16.8.0 || ^17.0.0",
"react-dom": "^16.8.0 || ^17.0.0"
},
"dependencies": {
"clsx": "^1.1.0",
"hoist-non-react-statics": "^3.3.0"
},
"bugs": {
"url": "https://github.com/iamhosseindhv/notistack/issues"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/notistack"
},
"contributors": [
"Hossein Dehnokhalaji (https://www.iamhosseindhv.com/)"
],
"keywords": [
"notistack",
"enqueueSnackbar",
"snackbarprovider",
"useSnackbar",
"multiple",
"react",
"javascript",
"material-ui",
"toast",
"redux",
"snackbar",
"stacked",
"notification",
"material design",
"hossein",
"dehnokhalaji",
"iamhosseindhv"
],
"yalcSig": "073ef039ed1e473029c88b6ad9af16d9"
}
更新
添加应用程序package.json
{
"name": "greta-thunberg-fff",
"version": "1.2.9",
"private": true,
"homepage": "https://greta.portplays.com",
"main": "index.js",
"module": "dist/index.js",
"files": [
"dist",
"README.md"
],
"dependencies": {
"@material-ui/core": "^4.11.2",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.57",
"@material-ui/styles": "^4.11.2",
"axios": "^0.19.2",
"bootstrap": "^4.5.2",
"change-case": "^4.1.2",
"classnames": "^2.3.1",
"clean-tag": "^3.1.1",
"clsx": "^1.1.1",
"comma-separated-values": "^3.6.4",
"crypto-js": "^4.0.0",
"date-fns": "^2.23.0",
"faker": "^5.5.3",
"firebase": "^7.23.0",
"formik": "^2.2.5",
"framer-motion": "^2.9.5",
"gsap": "^3.5.1",
"history": "^5.0.0",
"i": "^0.3.6",
"lodash": "^4.17.19",
"lodash.debounce": "^4.0.8",
"mammoth": "^1.4.11",
"material-table": "^1.69.2",
"moment": "^2.27.0",
"my-notistack-fork": "file:.yalc/my-notistack-fork",
"normalize-wheel": "^1.0.1",
"npm": "^7.11.2",
"pdfjs-dist": "^1.8.357",
"preval.macro": "^5.0.0",
"prop-types": "^15.7.2",
"react": "^17.0.2",
"react-activity": "^1.2.2",
"react-bootstrap": "^1.3.0",
"react-chartjs-2": "^2.11.1",
"react-data-grid": "^6.1.0",
"react-detect-offline": "^2.4.0",
"react-dom": "^17.0.2",
"react-dropzone": "^11.3.4",
"react-helmet": "^6.1.0",
"react-motion": "^0.5.2",
"react-perfect-scrollbar": "^1.5.8",
"react-redux": "^7.2.5",
"react-resize-detector": "^5.0.7",
"react-router": "^6.0.0-beta.4",
"react-router-dom": "^6.0.0-beta.4",
"react-scripts": "^3.4.0",
"react-slick": "^0.27.3",
"react-spring": "^8.0.27",
"react-transition-group": "^4.4.1",
"react-visibility-sensor": "^5.1.1",
"rebass": "^4.0.7",
"recompose": "^0.30.0",
"redux": "^4.1.1",
"redux-logger": "^3.0.6",
"redux-saga": "^1.1.3",
"redux-thunk": "^2.3.0",
"reselect": "^4.0.0",
"sass": "^1.41.1",
"simplebar-react": "^2.3.5",
"slick-carousel": "^1.8.1",
"styled-components": "^5.1.1",
"styled-system": "^5.1.5",
"three": "^0.85.2",
"typescript": "^3.9.7",
"uuid": "^8.3.1",
"xlsx": "^0.10.1",
"yup": "^0.32.1"
},
"scripts": {
"start": "set PORT=6545&& react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "gh-pages -b master -d build"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.1.1",
"@typescript-eslint/parser": "^4.1.1",
"axios": "^0.19.2",
"babel-eslint": "^10.1.0",
"clean-tag": "^3.1.1",
"eslint": "^6.6.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.1.2",
"gh-pages": "^2.0.1",
"prettier": "^2.1.1",
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-scripts": "^3.4.3",
"rebass": "^4.0.7",
"styled-system": "^5.1.5"
}
}
发布于 2021-10-24 07:00:20
我使用yalc add notistack
复制了您的设置,并注意到yalc push
没有编译这个包。当我添加标记--scripts
(如文档中所描述的)时,它起了作用:
默认情况下,
scripts
选项是假的,因此它不会运行预/后脚本(可能会通过传递--scripts
标志来更改这一点)。
您还可以运行yalc publish
,然后运行yalc push
或yalc publish --push
。
为了使更改在应用程序中生效,我不得不再次运行npm start
。
这是通知堆栈依赖项在package.json中的外观。
"notistack": "file:.yalc/notistack",
更新
正如您所指出的,我还尝试通过在my-notistack-fork
中更改名称将包重命名为package.json
。
{
"name": "my-notistack-fork",
"version": "2.0.2",
"description": "Highly customizable notification snackbars (toasts) that can be stacked on top of each other",
然后用yalc remove notistack
删除我的应用程序中的通知堆栈依赖项,然后使用新的名称yalc add my-notistack-fork
再次添加它。之后,我对库代码进行了修改,并运行了yalc publish --push
,在再次运行应用程序时可以看到它们的反映。依赖性如下所示
"my-notistack-fork": "file:.yalc/my-notistack-fork",
有趣的是,对于我来说,在应用程序node_modules中,lib目录已经编译了文件,而屏幕快照中的错误有一个src
dir,它给人的印象是它是未编译的。
https://stackoverflow.com/questions/69575534
复制相似问题