manuelbieh / react-ssr-setup

React Starter Project with Webpack 4, Babel 7, TypeScript, CSS Modules, Server Side Rendering, i18n and some more niceties

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how do use ant.design UI in this project?

zkeyword opened this issue · comments

I try write it in babal.config.js:

['import', { 'libraryName': 'antd', 'libraryDirectory': 'lib', 'style': 'css' }],

and use:
import { Modal } from 'antd'

but, throw error:

`
/Users/zkeyword/Documents/ssr/node_modules/antd/lib/style/index.css:7
body {
^
SyntaxError: Unexpected token {
at Module._compile (internal/modules/cjs/loader.js:718:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:681:19)

`

Hello!

I'm having a similar issue, I'm trying out the project and I've installed an npm package that imports '.css' files into it's own files.
However the server build throws an error complaining about Unexpected token in the css file.
It seems to be that there is something off in the server webpack config, but still trying to find out.