I am trying to build a Vue macro app to use in NetSuite for specific functionality. Since I cannot use npm or other package installers, I need to use CDN. The Vue app is working, and even Ant Design is also working. The only problem I am having is that it is not picking up the styles for any Ant Design component. This is my code:
<html>
<head>
<title>Auto Refresh Page</title>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<link href="https://unpkg.com/[email protected]/dist/antd.min.css" rel="stylesheet">
</link>
<script src="https://unpkg.com/dayjs/dayjs.min.js"></script>
<script src="https://unpkg.com/dayjs/plugin/customParseFormat.js"></script>
<script src="https://unpkg.com/dayjs/plugin/weekday.js"></script>
<script src="https://unpkg.com/dayjs/plugin/localeData.js"></script>
<script src="https://unpkg.com/dayjs/plugin/weekOfYear.js"></script>
<script src="https://unpkg.com/dayjs/plugin/weekYear.js"></script>
<script src="https://unpkg.com/dayjs/plugin/advancedFormat.js"></script>
<script src="https://unpkg.com/dayjs/plugin/quarterOfYear.js"></script>
</head>
<body>
<div id="app">
</div>
<script src="https://unpkg.com/[email protected]/dist/antd.min.js"></script>
<script>
const app = Vue.createApp({
el: "#app",
data() {
return {
moduleLoaded: false,
currentRecordModule: null,
backgroundProcess: false,
showModal: false,
};
},
methods: {
init() {
const currentRecordModule = require(['N/currentRecord'], (currentRecord) => {
this.moduleLoaded = true
this.currentRecordModule = currentRecord
});
},
reloadPage() {
location.reload(true)
},
showAlert() {
this.showModal = true
const iframeHtml = '<iframe src="${activeBgTaskUrl}" style="width: 100%; height: 400px; border: none;"></iframe>';
},
handleShowBackgroundProcessAlert(event) {
if (event.target.id === 'showBackgroundProcessAlert') {
this.showAlert()
}
},
},
mounted() {
console.log('App mounted')
this.init();
document.addEventListener('click', this.handleShowBackgroundProcessAlert)
},
},
template: `<a-button icon="search" type="primary">Primary Button</a-button>
<a-modal v-model:visible="showModal" title="Basic Modal" @ok="handleOk">
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
</a-modal>`
});
app.mount('#app');
</script>
</body>
</html>
I want to open a modal in the showAlert function. I have tried multiple things, including directly accessing the Ant Design global variable, using the import statement, and using the require method, but none of them are working. The button is showing, but without any styles, and the same goes for the modal. For those who know NetSuite, creating a Suitelet is not an option.
EDIT
It is not loading the ant design components too and giving me these warnings:
[Vue warn]: Failed to resolve component: a-modal
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
[Vue warn]: Failed to resolve component: a-button
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
Edit-2
My source in browser is looking like this:
I am able to access the Vue but not antd. Why is that?

In the Ant Design Vue (antdv) documentation, there is a section explaining how to import it in the browser:
Import in Browser
Add
scriptandlinktags in your browser and use the global variableantd.You need to add the global variable antd in app.use().
For example: