标题是发生的错误。我在 package.json 中创建脚本,但我想动态使用npmor yarn。我读过可以使用名为“$npm_execpath”的环境变量来实现此目的,但它不适用于我的配置。这是 package.json 部分的示例:
"scripts": {
"start": "run-p start:jsonserver start:dev",
"start:dev": "node --max_old_space_size=4096 node_modules/webpack-dev-server/bin/webpack-dev-server.js --config ./config/webpack/webpack.standalone.dev.js --open",
"start:prod": "webpack-dev-server --config ./config/webpack/webpack.standalone.prod.js",
"start:container": "webpack-dev-server --host 0.0.0.0 --port 4555",
"start:jsonserver": "node ../Testing.GtP.UI.MockServer/server.js",
"build:dev": "npm run build:standalone:dev && npm run build:module:dev"
},
Run Code Online (Sandbox Code Playgroud)
我正在尝试运行“构建”脚本,如下所示:
yarn build / npm run build
但在每个都显示错误:
“$npm_execpath”未被识别为内部或外部命令、程序或可执行批处理文件
我希望你可以帮助我。提前致谢。
我是样式组件的新手,我希望能够正确输入样式组件,这样当我传递道具“vs 代码”时,我可以自动检测我拥有的所有道具,而不仅仅是主题中的道具或那些道具我可以放一个接口。
正如我在其他一些答案中看到的那样,有没有办法不使用 HOC呢?是否有可能获得一个通用的道具,而不必像示例中那样在每个样式属性中定义 this ?
app.theme.ts
export const theme = {
palette: {
primaryColor: '#FF5018',
secondaryColor: '#252729',
tertiaryColor: '#1A1C1E',
textColor: 'white',
},
};
export type Theme = typeof theme;
Run Code Online (Sandbox Code Playgroud)
导航栏.styled.component.ts
export const NavigationBarStyled = styled.div`
grid-area: navigation-bar-item;
padding-left: 2rem;
display: flex;
align-items: center;
color: ${({ theme }) => theme.palette.primaryColor};
background-color: ${({ theme }) => theme.palette.primaryColor};
`;
Run Code Online (Sandbox Code Playgroud)
提前致谢,最好的