enuchi / React-Google-Apps-Script

This is your boilerplate project for developing React apps inside Google Sheets, Docs, Forms and Slides projects. It's perfect for personal projects and for publishing complex add-ons in the Google Workspace Marketplace.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ReferenceError: antd is not defined

codeatrajan opened this issue · comments

Hi I have made a fresh clone of the repo
and Installed the packages and Its working fine,

And i have tried to add a new package npm i antd

and updated the webpack.config.js for adding CDN

case 'antd':
return {
name: packageName,
var: 'antd',
version: packageVersion,
url: https://unpkg.com/antd@${packageVersion}/dist/antd${packageSuffix},
};
But after deploying getting ReferenceError: antd is not defined
this is the CDN Link https://unpkg.com/antd@5.7.3/dist/antd.min.js

Can you research if antd has a UMD build?

See here: https://ant.design/docs/react/introduce#import-in-browser and the note there:

Note: You should import react、react-dom、dayjs before using antd.js.

I got this to work by adding the following to the index.html template in the <head> tag:

<script src="https://unpkg.com/dayjs@1.11.9/dayjs.min.js"></script>

and using the antd config in webpack.config.js that you shared above.

See the basic changes needed here: 0d074a0

Yes, Now I can able add it after adding dayjs.

Thanks for providing this great project and support.

Happy to help