mirror of
https://github.com/sunniejs/vue-h5-template.git
synced 2025-06-12 12:29:31 +08:00
解决bable cannot call a class as a func
This commit is contained in:
parent
ca44e7447a
commit
679cc07160
12
.babelrc
12
.babelrc
@ -1,12 +0,0 @@
|
||||
{
|
||||
"presets": [
|
||||
[ "@babel/preset-env", {
|
||||
"targets": {
|
||||
"browsers": [ "last 1 version", "ie >= 11" ]
|
||||
}
|
||||
}]
|
||||
],
|
||||
"plugins": [
|
||||
"@babel/plugin-transform-runtime"
|
||||
]
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
process.env.VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||
module.exports = {
|
||||
presets: [['@vue/app', { useBuiltIns: 'entry' }]],
|
||||
plugins: [
|
||||
|
@ -1,27 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<% for (var i in
|
||||
htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.css) { %>
|
||||
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style" />
|
||||
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet" />
|
||||
<% } %>
|
||||
<title><%= webpackConfig.name %></title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but <%= webpackConfig.name %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- 使用CDN加速的JS文件,配置在vue.config.js下 -->
|
||||
<% for (var i in
|
||||
htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %>
|
||||
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
|
||||
<% } %>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
@ -5,6 +5,11 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<% for (var i in
|
||||
htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.css) { %>
|
||||
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style" />
|
||||
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet" />
|
||||
<% } %>
|
||||
<title><%= webpackConfig.name %></title>
|
||||
</head>
|
||||
<body>
|
||||
@ -13,6 +18,10 @@
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- 使用CDN加速的JS文件,配置在vue.config.js下 -->
|
||||
<% for (var i in
|
||||
htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %>
|
||||
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
|
||||
<% } %>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,5 +1,4 @@
|
||||
import Vue from 'vue'
|
||||
import '@babel/polyfill'
|
||||
import 'normalize.css/normalize.css' // A modern alternative to CSS resets
|
||||
import '@/assets/css/index.scss' // global css
|
||||
// 移动端适配
|
||||
@ -11,6 +10,7 @@ import '@/filters' // filters
|
||||
import '@/utils/directives' // directives
|
||||
import '@/permission' // permission control
|
||||
import wechatAuth from './plugins/wechatAuth' // 微信登录插件
|
||||
|
||||
Vue.use(wechatAuth, {
|
||||
appid: process.env.VUE_APP_WECHAT_APPID
|
||||
})
|
||||
|
@ -4,14 +4,6 @@ import getPageTitle from '@/utils/get-page-title'
|
||||
import wechatAuth from './plugins/wechatAuth' // 微信登录插件
|
||||
const qs = require('qs')
|
||||
router.beforeEach((to, from, next) => {
|
||||
// next()
|
||||
// store.dispatch('user/fedLogOut').then(() => {
|
||||
// // location.reload()
|
||||
// })
|
||||
// store.dispatch('user/setLoginStatus', 0)
|
||||
// alert(store.getters.loginStatus)
|
||||
// return false
|
||||
// alert(store.getters.loginStatus)
|
||||
const loginStatus = Number(store.getters.loginStatus)
|
||||
document.title = getPageTitle(to.meta.title)
|
||||
if (loginStatus === 0) {
|
||||
|
@ -101,8 +101,8 @@ class VueWechatAuthPlugin {
|
||||
|
||||
const vueWechatAuthPlugin = new VueWechatAuthPlugin()
|
||||
|
||||
if (typeof window !== 'undefined' && window.Vue) {
|
||||
window.Vue.use(VueWechatAuthPlugin)
|
||||
}
|
||||
// if (typeof window !== 'undefined' && window.Vue) {
|
||||
// window.Vue.use(VueWechatAuthPlugin)
|
||||
// }
|
||||
|
||||
export default vueWechatAuthPlugin
|
||||
|
@ -1,5 +1,6 @@
|
||||
'use strict'
|
||||
const path = require('path')
|
||||
const defaultSettings = require('./src/config/index.js')
|
||||
function resolve(dir) {
|
||||
return path.join(__dirname, dir)
|
||||
}
|
||||
@ -24,7 +25,7 @@ const cdn = {
|
||||
build: {
|
||||
css: ['https://cdn.jsdelivr.net/npm/vant@beta/lib/index.css'],
|
||||
js: [
|
||||
// 'https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.4.4/polyfill.min.js',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.4.4/polyfill.min.js',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.min.js',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/vue-router/3.0.6/vue-router.min.js',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js',
|
||||
@ -37,6 +38,7 @@ const cdn = {
|
||||
module.exports = {
|
||||
publicPath: process.env.NODE_ENV === 'production' ? '/antpublic/' : '/',
|
||||
outputDir: 'dist',
|
||||
// outputDir: '../../../phpStudy/PHPTutorial/WWW/antpublic',
|
||||
assetsDir: 'static',
|
||||
lintOnSave: process.env.NODE_ENV === 'development',
|
||||
productionSourceMap: false,
|
||||
@ -49,18 +51,23 @@ module.exports = {
|
||||
},
|
||||
disableHostCheck: true
|
||||
},
|
||||
// configureWebpack: config => {
|
||||
// // 为生产环境修改配置...
|
||||
// if (process.env.NODE_ENV === 'production') {
|
||||
// // externals里的模块不打包
|
||||
// Object.assign(config, {
|
||||
// externals: externals
|
||||
// })
|
||||
// }
|
||||
// // 为开发环境修改配置...
|
||||
// if (process.env.NODE_ENV === 'development') {
|
||||
// }
|
||||
// },
|
||||
configureWebpack: config => {
|
||||
// 为生产环境修改配置...
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
// externals里的模块不打包
|
||||
Object.assign(config, {
|
||||
name: defaultSettings.title,
|
||||
// entry: ['@babel/polyfill', './src/main.js'],
|
||||
externals: externals,
|
||||
optimization: {
|
||||
minimize: false
|
||||
}
|
||||
})
|
||||
}
|
||||
// 为开发环境修改配置...
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
}
|
||||
},
|
||||
chainWebpack(config) {
|
||||
config.plugins.delete('preload') // TODO: need test
|
||||
config.plugins.delete('prefetch') // TODO: need test
|
||||
@ -74,16 +81,15 @@ module.exports = {
|
||||
/**
|
||||
* 添加CDN参数到htmlWebpackPlugin配置中, 详见public/index.html 修改
|
||||
*/
|
||||
// config.plugin('html').tap(args => {
|
||||
// if (process.env.NODE_ENV === 'production') {
|
||||
// args[0].cdn = cdn.build
|
||||
// }
|
||||
// if (process.env.NODE_ENV === 'development') {
|
||||
// args[0].cdn = cdn.dev
|
||||
// }
|
||||
// console.log(args)
|
||||
// return args
|
||||
// })
|
||||
config.plugin('html').tap(args => {
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
args[0].cdn = cdn.build
|
||||
}
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
args[0].cdn = cdn.dev
|
||||
}
|
||||
return args
|
||||
})
|
||||
|
||||
// set preserveWhitespace
|
||||
config.module
|
||||
|
Loading…
x
Reference in New Issue
Block a user