本帖最后由 douniwan 于 2021-4-26 11:35 编辑
jeecgboot2.2.1前端运行正常,打包后极简方式部署报错 我在使用jeecgBoot2.2.1开发时,前端项目能正常运行,但是按照开发文档上极简部署方案部署时报错。具体操作步骤如下:
①在使用yarn install 时报这些警告信息:
warning " > vue-loader@15.9.3" has unmet peer dependency "css-loader@*".
warning " > vue-loader@15.9.3" has unmet peer dependency "webpack@^3.0.0 || ^4.1.0 || ^5.0.0-0".
warning " > compression-webpack-plugin@3.1.0" has unmet peer dependency "webpack@^4.3.0 || ^5.0.0".
warning " > html-webpack-plugin@4.3.0" has unmet peer dependency "webpack@>=4.0.0 < 6.0.0".
warning " > less-loader@4.1.0" has unmet peer dependency "webpack@^2.0.0 || ^3.0.0 || ^4.0.0".
②修改src/utils/request.js
③修改public/index.html
window._CONFIG = {};
window._CONFIG['domianURL'] = 'http://localhost:8090';④修改src/router/index.js
export default new Router({
mode: 'hash',
base: process.env.BASE_URL,
scrollBehavior: () => ({ y: 0 }),
routes: constantRouterMap
})⑤运行npm run build 控制台输出如下警告:
chunk chunk-b19046ee [mini-css-extract-plugin]
Conflicting order. Following module has been added:
* css ./node_modules/_css-loader@1.0.1@css-loader??ref--6-oneOf-1-1!./node_modules/_vue-loader@15.9.6@vue-loader/lib/loaders/stylePostLoader
.js!./node_modules/_postcss-loader@3.0.0@postcss-loader/src??ref--6-oneOf-1-2!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??re
f--0-0!./node_modules/_vue-loader@15.9.6@vue-loader/lib??vue-loader-options!./src/views/jeecg/tablist/form/JeecgOrderCustomerModal.vue?vue&ty
pe=style&index=0&id=800ce91c&scoped=true&lang=css&
despite it was not able to fulfill desired ordering with these modules:
* css ./node_modules/_css-loader@1.0.1@css-loader??ref--6-oneOf-1-1!./node_modules/_vue-loader@15.9.6@vue-loader/lib/loaders/stylePostLoader
.js!./node_modules/_postcss-loader@3.0.0@postcss-loader/src??ref--6-oneOf-1-2!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??re
f--0-0!./node_modules/_vue-loader@15.9.6@vue-loader/lib??vue-loader-options!./src/views/jeecg/tablist/form/JeecgOrderDMainModal.vue?vue&type=
style&index=0&id=3947da84&scoped=true&lang=css&
- couldn't fulfill desired order of chunk group(s)
⑥将dist文件夹拷贝至resources/static文件夹下,并修改application-dev.yml和WebMvcConfiguration.java
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("index.html");
}⑦运行JeecgApplication,浏览器访问8090,报错
Whitelabel Error PageThis application has no explicit mapping for /error, so you are seeing this as a fallback. Mon Apr 26 11:31:53 CST 2021
There was an unexpected error (type=Internal Server Error, status=500).
Error resolving template [index.html], template might not exist or might not be accessible by any of the configured Template Resolvers
我已经试过很多次了,每次都是同样的问题,望请回复并解答,谢谢!
|