Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: 打包后部署,样式全部失效 #2202

Closed
wchbrad opened this issue Sep 19, 2024 · 1 comment
Closed

bug: 打包后部署,样式全部失效 #2202

wchbrad opened this issue Sep 19, 2024 · 1 comment

Comments

@wchbrad
Copy link

wchbrad commented Sep 19, 2024

Version

2.4.9

OS Version

windows 11

Node.js Version

20.17.0

Browser Version

chrome 128.0.6613.138(正式版本) (64 位)

Link to minimal reproduction

使用官方脚手架npx create-dumi初始化

Steps to reproduce

使用官方脚手架初始化成功

npx create-dumi
Need to install the following packages:
[email protected]
Ok to proceed? (y) y

√ Pick template type » React Library
√ Pick NPM client » pnpm
√ Input NPM package name ... ac
√ Input project description ... A react library developed with dumi
√ Input project author (Name <[email protected]>) ...
Write: .dumirc.ts
Copy:  .editorconfig
Copy:  .eslintrc.js
Copy:  .fatherrc.ts
Write: .gitignore
Copy:  .husky/commit-msg
Copy:  .husky/pre-commit
Copy:  .prettierignore
Copy:  .prettierrc.js
Copy:  .stylelintrc
Copy:  docs/guide.md
Write: docs\index.md
Write: LICENSE
Write: package.json
Write: README.md
Write: src\Foo\index.md
Copy:  src/Foo/index.tsx
Copy:  src/index.ts
Write: tsconfig.json
Downloading [email protected]: 5.76 MB/5.76 MB, done
Downloading @swc/[email protected]: 16.52 MB/16.52 MB, done
Downloading @formatjs/[email protected]: 6.00 MB/6.00 MB, done
Downloading @umijs/[email protected]: 16.33 MB/16.33 MB, done
 WARN  19 deprecated subdependencies found: @floating-ui/[email protected], @humanwhocodes/[email protected], @humanwhocodes/[email protected], @stylelint/[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Packages: +1619
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 1718, reused 0, downloaded 1620, added 1619, done
node_modules/.pnpm/[email protected]/node_modules/core-js: Running postinstall script, done in 188ms
node_modules/.pnpm/[email protected]/node_modules/core-js-pure: Running postinstall script, done in 189ms
node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@swc/core: Running postinstall script, done in 180ms
node_modules/.pnpm/[email protected]/node_modules/esbuild: Running postinstall script, done in 1.6s
node_modules/.pnpm/[email protected]/node_modules/esbuild: Running postinstall script, done in 1.5s
node_modules/.pnpm/[email protected]/node_modules/esbuild: Running postinstall script, done in 1.3s

> [email protected] prepare D:\demo
> husky install && dumi setup

fatal: not a git repository (or any of the parent directories): .git
husky - git command not found, skipping install
info  - dumi v2.4.11
info  - generate files

devDependencies:
+ @commitlint/cli 17.8.1 (19.5.0 is available)
+ @commitlint/config-conventional 17.8.1 (19.5.0 is available)
+ @types/react 18.3.7
+ @types/react-dom 18.3.0
+ @umijs/lint 4.3.20
+ dumi 2.4.11
+ eslint 8.57.1 (9.10.0 is available)
+ father 4.5.0
+ husky 8.0.3 (9.1.6 is available)
+ lint-staged 13.3.0 (15.2.10 is available)
+ prettier 2.8.8 (3.3.3 is available)
+ prettier-plugin-organize-imports 3.2.4 (4.0.0 is available)
+ prettier-plugin-packagejson 2.5.2
+ react 18.3.1
+ react-dom 18.3.1
+ stylelint 14.16.1 (16.9.0 is available)

Done in 1m 26.2s

然后打包文档

pnpm docs:build

> [email protected] docs:build D:\demo
> dumi build

info  - dumi v2.4.11
info  - Umi v4.3.20

√ Webpack
  Compiled successfully in 10.10s

info  - Memory Usage: 462.06 MB (RSS: 590.62 MB)

● Webpack █████████████████████████ cache (99%)
 shutdown


info  - File sizes after gzip:

  302.82 kB  docs-dist\umi.b156075b.js
  62.91 kB   docs-dist\145.75ea0e35.async.js
  39.29 kB   docs-dist\717.e8c51481.chunk.css
  29.88 kB   docs-dist\717.9cf77e61.async.js
  22.6 kB    docs-dist\27.8e02c3a2.async.js
  6.24 kB    docs-dist\umi.b7ce68f4.css
  820 B      docs-dist\dumi__tmp-production__dumi__theme__ContextWrapper.9c96dbec.async.js
  775 B      docs-dist\meta__Foo.abd97ca4.async.js
  492 B      docs-dist\nm__dumi__dist__client__pages__Demo__index.ff8aa483.async.js
  467 B      docs-dist\Foo__index.md.75021826.async.js
  350 B      docs-dist\docs__guide.md.3b53c5ca.async.js
  349 B      docs-dist\docs__index.md.224d0348.async.js
  319 B      docs-dist\nm__dumi__theme-default__layouts__DocLayout__index.b114e3d8.async.js
  307 B      docs-dist\nm__dumi__dist__client__pages__404.802aac62.async.js
  277 B      docs-dist\nm__dumi__dist__client__pages__404.8b85f2d9.chunk.css
  249 B      docs-dist\meta__docs.f50542a9.async.js
  45 B       docs-dist\nm__dumi__dist__client__pages__Demo__index.578aa5c0.chunk.css

event - Build 404.html
event - Build guide\index.html
event - Build index.html
event - Build components\foo\index.html
event - Build ~demos/foo-demo-0/index.html

部署到nginx上,打开页面,页面未报错,但是所有的样式失效了
image

请问是怎么回事

What is expected?

文档样式正常显示,与开发环境一致

What is actually happening?

文档样式全部失效
image

Any additional comments? (optional)

No response

@wchbrad
Copy link
Author

wchbrad commented Sep 19, 2024

已解决

@wchbrad wchbrad closed this as completed Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant