I tried to define a button in App.vue and introduced the cdn of ej2-vue-buttons.umd.min.js in index.html
index.html
App.vue
vue.config.js
error in console
<template>
<div>
<ejs-button :isPrimary="true">{{content}}</ejs-button>
</div>
</template>
<script>
import Vue from 'vue';
import { ButtonPlugin } from '@syncfusion/ej2-vue-buttons';
Vue.use(ButtonPlugin);
export default {
data() {
return {
content: 'Test',
};
},
};
</script>
<style lang='scss'>
@import '../node_modules/@syncfusion/ej2-vue-buttons/styles/bootstrap4.css';
</style> |
thank you for your reply,My requirement is to exclude syncfusion components through externals configuration and import them as cdn in index.html.(Do not change the development code, only through configuration).
The purpose is not to package syncfusion, in order to reduce the packaging volume of the project.
so,I modified it on the basis of the quick start you provided(attachment)。
1.add externals in webpack.config.js
2. add cdn in index.html
3. run it by "npm run dev",But the console has some errors
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>quickstart</title>
<link rel='nofollow' href="crg/styles/material.css" rel="stylesheet" />
<script src="crg/scripts/ej2.js" type="text/javascript"></script>
<div id="app"></div>
<script src="dist/build.js"></script>
</head>
<body>
</body>
</html>
|
Sorry, I think I made a mistake in the configuration of externals,and I changed it.
In fact, I don’t know how to write this externals configuration,Please help me.
Then it outputs an error
Hi , is there any progress on this issue?
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Syncfusion Vue (ES5) UI Components</title>
<!-- Essentail JS2 for Vue (All components Styles) -->
<link rel='nofollow' href="https://cdn.syncfusion.com/ej2/material.css" rel="stylesheet" type="text/css" />
<!-- Vue library file-->
<script src="/node_modules/vue/dist/vue.min.js"></script>
<!-- Essential JS 2 for Vue global script -->
<script src="https://cdn.syncfusion.com/ej2/ej2-vue-es5/dist/ej2-vue.min.js" type="text/javascript"></script>
</head>
<body>
<h2>Syncfusion Vue (ES5) Button Components</h2>
<div id="app">
<ejs-button is-primary="true">Button</ejs-button>
</div>
<script>
// Registering the Button plugin.
Vue.use(ejs.buttons.ButtonPlugin);
new Vue({
el: '#app',
});
</script>
</body>
</html>
|
Thanks for your reply, but this is not what I want. We have used vue+syncfusion to develop several projects, which are close to completion. Now we just want to extract the common syncfusion components and put them in index.html to facilitate the use of browser caching.
If follow what you provided, all the places where syncfusion components are used need to be modified.
For example:
1.Simple
import {ButtonPlugin} from'@syncfusion/ej2-vue-buttons';
Vue.use(ButtonPlugin);
change to
const ejs = window.ejs;
Vue.use(ejs.buttons.ButtonPlugin);
2.complicated
import { GridPlugin, Page, Sort, Filter, Group, Aggregate } from "@syncfusion/ej2-vue-grids";
Vue.use(GridPlugin);
change to
const ejs = window.ejs;
Vue.use(ejs.grids.GridPlugin);
const Page = ejs.grids.Page;
const Sort = ejs.grids.Sort;
const Filter = ejs.grids.Filter;
const Group = ejs.grids.Group;
const Aggregate = ejs.grids.Aggregate;
What I want is to be like Vue, only modify the configuration to exclude large components, without modifying the code in the page (import or other)