oceanbase / oceanbase-design

An enterprise-class design system based on Ant Design and extending it.
https://design.oceanbase.com
MIT License
33 stars 18 forks source link

[Bug]: <script> `pnpm run dev` is not working in winodws #4

Closed wzc520pyfm closed 1 year ago

wzc520pyfm commented 1 year ago
"dev": "npx babel --presets @babel/preset-env packages/design/src/theme/index.ts --out-file ./.dumi/tmp/plugin-theme-less/theme.js && UMI_ENV=theme dumi dev",

image

dengfuping commented 1 year ago
pnpm install cross-env --save-dev -w
cross-env UMI_ENV=theme dumi dev
wzc520pyfm commented 1 year ago

yes, we should use cross-env to set arg on terminal. But I have a new problem in windows:

  1. install cross-env
  2. update dev script by cross-env UMI_ENV=theme dumi dev
  3. pnpm install
  4. pnpm run start

error:

Unhandled Rejection (Error): Module build failed (from ./node_modules/.pnpm/registry.npmmirror.com+@umijs+bundler-webpack@4.0.72_typescript@5.1.6/node_modules/@umijs/bundler-webpack/compiled/babel-loader/index.js):
SyntaxError: D:\Code\github-work\oceanbase-design\.dumi\pages\index\components\BannerRecommends.tsx?type=meta: Unexpected token, expected "from" (4:12)

  2 | import { Typography, Carousel } from '@oceanbase/design';
  3 | import { ArrowRightOutlined } from '@oceanbase/icons';
> 4 | import type { SerializedStyles } from '@emotion/react';
    |             ^
  5 | import { css } from '@emotion/react';
  6 | import { Link } from 'dumi';
  7 | import type { Extra, Icon } from './util';
    at instantiate (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:84800:32)
    at constructor (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:85095:12)
    at JSXParserMixin.raise (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:87992:19)
    at JSXParserMixin.unexpected (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:88022:16)
    at JSXParserMixin.expectContextual (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:88341:12)
    at JSXParserMixin.parseImportSpecifiersAndAfter (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:98861:10)
    at JSXParserMixin.parseImport (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:98853:17)
    at JSXParserMixin.parseStatementContent (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:97443:27)
    at JSXParserMixin.parseStatementLike (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:97321:17)
    at JSXParserMixin.parseModuleItem (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:97298:17)
    at JSXParserMixin.parseBlockOrModuleBlockBody (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:97922:36)
    at JSXParserMixin.parseBlockBody (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:97915:10)
    at JSXParserMixin.parseProgram (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:97197:10)
    at JSXParserMixin.parseTopLevel (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:97187:25)
    at JSXParserMixin.parse (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:99084:10)
    at parse (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:99104:26)
    at parser (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:43749:34)
    at parser.next (<anonymous>)
    at normalizeFile (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:45060:38)
    at normalizeFile.next (<anonymous>)
    at run (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:44910:50)
    at run.next (<anonymous>)
    at transform (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:44412:41)
    at transform.next (<anonymous>)
    at step (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:10186:32)
    at D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:10198:13
    at async.call.result.err.err (D:\Code\github-work\oceanbase-design\node_modules\.pnpm\registry.npmmirror.com+@umijs+bundler-utils@4.0.72\node_modules\@umijs\bundler-utils\compiled\babel\index.js:10148:11)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

and more:

__webpack_require__
.root/webpack/bootstrap:24
  21 |  var execOptions = { id: moduleId, module: module, factory: __webpack_modules__[moduleId], require: __webpack_require__ };
  22 |  __webpack_require__.i.forEach(function(handler) { handler(execOptions); });
  23 |  module = execOptions.module;
> 24 |  execOptions.factory.call(module.exports, module, module.exports, execOptions.require);
     | ^  25 | } catch(e) {
  26 |  module.error = e;
  27 |  throw e;
dengfuping commented 1 year ago

@wzc520pyfm Adding cross-env works for me in MacOS. So It seems unrelated to cross-env. Could removing cross-env fix this error?

image

wzc520pyfm commented 1 year ago

The pnpm dev won't run on my windows without using cross-env. After using cross-env, the pnpm dev worked fine, but it failed to load after I opened localhost.

dengfuping commented 1 year ago

The pnpm dev won't run on my windows without using cross-env. After using cross-env, the pnpm dev worked fine, but it failed to load after I opened localhost.