element UI vue脚手架 接入cdn
vue.config.js
module.exports = {
configureWebpack:{
externals: {
'element-ui': 'ELEMENT',
vue: 'Vue'
}}
//externals 配置来告诉 Webpack 不要打包它。
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="https://online-education.codemao.cn/crm/2/customer/favicon.ico">
<title>测试平台</title>
<!-- cdn引入组件库 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
<!-- Vue.js CDN -->
#先引入vue
<script src="https://unpkg.com/vue@2.7.10/dist/vue.min.js"></script>
<!-- Element UI JS -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
</body>
</html>