ant-design/antd-mobile-samples

你好 我做同构的时候出问题了

Closed this issue · 3 comments

同构的时候出现下面问题,请问如果是同构需要怎么做

ERROR in ./client/App.js
Module not found: Error: Cannot resolve module 'antd-mobile/lib/button/style/css
' in C:\DouBo.New.Web\client
@ ./client/App.js 7:11-54

ERROR in .//._antd-mobile@1.1.1@antd-mobile/lib/button/index.js
Module not found: Error: Cannot resolve module 'react-native' in C:\DouBo.New.We
b\node_modules._antd-mobile@1.1.1@antd-mobile\lib\button
@ ./
/._antd-mobile@1.1.1@antd-mobile/lib/button/index.js 12:17-40

ERROR in .//._antd-mobile@1.1.1@antd-mobile/lib/button/style/index.js
Module not found: Error: Cannot resolve module 'react-native' in C:\DouBo.New.We
b\node_modules._antd-mobile@1.1.1@antd-mobile\lib\button\style
@ ./
/._antd-mobile@1.1.1@antd-mobile/lib/button/style/index.js 2:17-40
Child html-webpack-plugin for "..\views\dev\index.html":
Asset Size Chunks Chunk Names
../views/dev/index.html 26.2 kB 0
chunk {0} ../views/dev/index.html 1.9 kB [rendered]
[0] ./~/._html-webpack-plugin@2.28.0@html-webpack-plugin/lib/loader.js!.
/views/tpl/index.tpl.html 1.9 kB {0} [built]
<-- GET /__webpack_hmr
webpack building...

看起来你是少了 css 相关的loader.

参考下这个服务端渲染的demo吧 https://github.com/ant-design/antd-mobile-samples/tree/master/web-next

demo 现在是404?

@andy1028 sorry,改文件夹名了: https://github.com/ant-design/antd-mobile-samples/tree/master/web-ssr

但所有官方demo都在这个仓库,可以直接在里面找