解決方案見評論區(qū)
版本如下CRMEB_PRO_PC_v3.0.1(20240326)
本地運(yùn)行沒問題,打包后放到線上報(bào)錯(cuò)Uncaught SyntaxError: Unexpected token '<'
線上網(wǎng)址 https://mall.odot.cn/
按照網(wǎng)上的一些教程修改publicPath 為 / 和./都不行
服務(wù)器目錄結(jié)構(gòu)如下
nutx.config.js配置如下
// const MODE = 'universal'; //靜態(tài)應(yīng)用部署,打包命令 npm run generate
const MODE = 'spa'; //單頁面形式渲染模式,打包命令: npm run build
module.exports = {
buildDir: "nuxt-dist",
mode: MODE,
// mode: 'universal',
/*
** Headers of the page
*/
head: {
title: "CRMEB PC端模板演示",
meta: [
{ charset: "utf-8" },
{ name: "apple-mobile-web-app-capable", content: "yes" },
{ name: "viewport", content: "width=device-width, initial-scale=1" },
{
hid: "http-equiv",
"http-equiv": "X-UA-Compatible",
content: "IE=edge"
},
{
hid: "keywords",
name: "keywords",
content:
"CRMEB 新零售社交電商 社交電商系統(tǒng) 小程序商城系統(tǒng) 公眾號商城系統(tǒng) 商城系統(tǒng)源碼 免費(fèi)商城系統(tǒng) 商城系統(tǒng)開發(fā) 開源商城系統(tǒng) CRMEB源碼 微商城源碼 多店商城系統(tǒng) 小程序直播電商系統(tǒng) 知識付費(fèi)系統(tǒng)源碼 SCRM 客戶管理 客戶營銷系統(tǒng) 多商戶商城 B2B2C B2C B2B O2O"
},
{
hid: "description",
name: "description",
content:
"CRMEB開源會員電商營銷系統(tǒng),依托社交營銷應(yīng)用場景,獨(dú)創(chuàng)將用戶管理系統(tǒng)與社交電商系統(tǒng)創(chuàng)新性深度集成,充分將公域流量轉(zhuǎn)為私域流量,幫助企業(yè)快速積累用戶并實(shí)現(xiàn)精準(zhǔn)營銷,一次購買永久享受免費(fèi)升級服務(wù)免費(fèi)提供升級教程。咨詢:400-8888-794"
}
],
link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }],
script: []
},
env: {
baseUrl: ""
},
/*
** Customize the progress-bar color
*/
loading: { color: "#fff" },
/*
** Plugins to load before mounting the App
*/
plugins: [
"~/plugins/axios",
{ src: "./assets/iconfont/iconfont.js", ssr: false },
{ src: "~/plugins/vue-swiper.js", ssr: false },
{ src: "~/plugins/utils.js", ssr: false },
{ src: "~/plugins/debounce.js", ssr: false },
{ src: "~/plugins/element-ui", ssr: false },
{ src: "~/plugins/vueqr.js", ssr: false },
{ src: "~/plugins/vue-clipboard.js", ssr: false },
{ src: "~/plugins/v-viewer.js", ssr: false },
{ src: "~/plugins/vue-lazyload.js",ssr: false },
"~/plugins/main",
{ src: "@/plugins/router", ssr: false },
],
/*
** Nuxt.js modules
*/
modules: [
"@nuxtjs/axios",
"@nuxtjs/auth",
"cookie-universal-nuxt",
"nuxt-sass-resources-loader"
],
sassResources: ["~assets/theme/element-variables.scss"],
/*
** Global CSS
*/
css: [
"~assets/iconfont/iconfont.css",
"~assets/css/index.scss",
// "~theme/index.css",
{ src: "swiper/dist/css/swiper.css" }
],
router: {
middleware: ["auth"]
},
auth: {
strategies: {
local1: {
_scheme: "local",
endpoints: {
login: {
url: "/login",
method: "post",
propertyName: "token"
},
logout: {
url: "/logout",
method: "get"
},
user: {
url: "user",
method: "get",
propertyName: false
}
}
},
local2: {
_scheme: "local",
endpoints: {
login: {
url: "/login/mobile",
method: "post",
propertyName: "token"
},
logout: {
url: "/logout",
method: "get"
},
user: {
url: "user",
method: "get",
propertyName: false
}
}
},
local3: {
_scheme: "local",
endpoints: {
login: {
url: "/pc/wechat_auth",
method: "get",
propertyName: "token"
},
logout: {
url: "/logout",
method: "get"
},
user: {
url: "user",
method: "get",
propertyName: false
}
}
}
},
redirect: {
login: "/login",
logout: "/",
callback: "/login",
home: false
},
cookie: {
options: {
maxAge: 60 * 60 * 24 * 7
}
},
localStorage: false
},
axios: {
baseURL: ""
},
// proxy: {
// '/api': {
// target: 'https://www.sxitdlc.com/server/api',
// pathRewrite: {
// '^/api': '/',
// changeOrigin: true // 表示是否跨域
// }
// }
// },
/*
** Build configuration
*/
distDir: "build",
/*
** Build configuration
*/
build: {
publicPath: "/home/",
publicPathFolder: MODE === 'spa' ? '/' : '',
transpile: [
'element-ui/src/locale/lang/th'
],
/*
** You can extend webpack config here
*/
extend(config, ctx) {},
babel: {
plugins: [
[
"component",
{
libraryName: "element-ui",
styleLibraryName: "theme-chalk"
}
]
]
}
},
server: {
port: 10822,
host: "0.0.0.0" // default: localhost
}
};