From 795d9319a6f81a98ed03f0be182c14e129f04a4f Mon Sep 17 00:00:00 2001 From: Todor Totev <51530311+TodorTotev@users.noreply.github.com> Date: Mon, 1 Jun 2020 22:08:59 +0300 Subject: [PATCH] Fix with antd ssg (#13611) Closes #12664 Closes #13604 The culprit was not only changing the library directory, but also having the icons version past 4.0.6. Also, the components which used the library had to be adjusted according to the new changes. Confirmed that it works both in production and development. Confirmed that it builds on dev and production. ![Alt Text](https://media.giphy.com/media/dZ46aA1Rs7Oi1wSQKU/giphy.gif) --- examples/with-ant-design/.babelrc | 4 ++-- .../with-ant-design/components/DatePicker.js | 2 +- examples/with-ant-design/package.json | 22 ++++++++++--------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/examples/with-ant-design/.babelrc b/examples/with-ant-design/.babelrc index 26ea61afec0bc..c52d7ff775442 100644 --- a/examples/with-ant-design/.babelrc +++ b/examples/with-ant-design/.babelrc @@ -5,7 +5,7 @@ "import", { "libraryName": "antd", - "libraryDirectory": "es", + "libraryDirectory": "lib", "style": "index.css" } ], @@ -13,7 +13,7 @@ "import", { "libraryName": "@ant-design/icons", - "libraryDirectory": "es/icons", + "libraryDirectory": "lib/icons", "camel2DashComponentName": false }, "@ant-design/icons" diff --git a/examples/with-ant-design/components/DatePicker.js b/examples/with-ant-design/components/DatePicker.js index ebde969870d96..40353328c64ae 100644 --- a/examples/with-ant-design/components/DatePicker.js +++ b/examples/with-ant-design/components/DatePicker.js @@ -7,7 +7,7 @@ * webpack plugin fixes that bug. */ import dayjsGenerateConfig from 'rc-picker/lib/generate/dayjs' -import generatePicker from 'antd/es/date-picker/generatePicker' +import generatePicker from 'antd/lib/date-picker/generatePicker' const DatePicker = generatePicker(dayjsGenerateConfig) diff --git a/examples/with-ant-design/package.json b/examples/with-ant-design/package.json index 33d583c29d3f0..795b2eb4eaf88 100755 --- a/examples/with-ant-design/package.json +++ b/examples/with-ant-design/package.json @@ -2,23 +2,25 @@ "name": "with-ant-design", "version": "1.0.0", "scripts": { - "dev": "cross-env NODE_OPTIONS=\"-r esm\" next", - "build": "cross-env NODE_OPTIONS=\"-r esm\" next build", - "analyze": "cross-env-shell NODE_OPTIONS=\"-r esm\" ANALYZE=true next build", + "dev": "next", + "build": "next build", "start": "next start" }, "dependencies": { - "@ant-design/icons": "^4.0.6", + "@ant-design/icons": "4.2.1", "@next/bundle-analyzer": "^9.1.4", - "antd": "4.1.2", + "antd": "4.3.0", "babel-plugin-import": "1.13.0", "cross-env": "^7.0.2", - "dayjs": "1.8.24", + "dayjs": "1.8.28", "esm": "^3.2.25", - "next": "9.3.4", + "next": "latest", "postcss-preset-env": "^6.7.0", - "react": "16.13.1", - "react-dom": "16.13.1" + "react": "^16.13.1", + "react-dom": "^16.13.1" }, - "license": "ISC" + "browser": { + "fs": false, + "path": false + } }