Commit 5db8d3522413bd4f437d27d6ab48d03e4ff2a74e
1 parent
d1455039
chore(engine) build engine with vue.config
Showing
3 changed files
with
67 additions
and
19 deletions
back-end/h5-api/views/engine.ejs
| ... | ... | @@ -43,7 +43,7 @@ |
| 43 | 43 | // setDocFontSize(320) |
| 44 | 44 | </script> |
| 45 | 45 | <script>window.__work = <%- JSON.stringify(work) %></script> |
| 46 | - <script src="/engine-assets/engine.js"></script> | |
| 46 | + <script src="/engine-assets/engine.umd.js"></script> | |
| 47 | 47 | <style> |
| 48 | 48 | * { |
| 49 | 49 | outline: none; | ... | ... |
front-end/h5/package.json
| ... | ... | @@ -6,14 +6,17 @@ |
| 6 | 6 | "serve": "vue-cli-service serve", |
| 7 | 7 | "build": "vue-cli-service build", |
| 8 | 8 | "lint": "vue-cli-service lint --fix", |
| 9 | + "deploy": "rm -rf dist && npm run build && ./deploy.sh", | |
| 9 | 10 | "test:e2e": "vue-cli-service test:e2e", |
| 10 | 11 | "test:unit": "vue-cli-service test:unit", |
| 11 | - "deploy": "rm -rf dist && npm run build && ./deploy.sh" | |
| 12 | + "editor:build": "PAGE=EDITOR vue-cli-service build", | |
| 13 | + "engine:build": "PAGE=ENGINE vue-cli-service build --target lib --name engine ./src/engine-entry.js" | |
| 12 | 14 | }, |
| 13 | 15 | "dependencies": { |
| 14 | 16 | "animate.css": "^3.7.2", |
| 15 | 17 | "ant-design-vue": "^1.3.14", |
| 16 | 18 | "core-js": "^2.6.5", |
| 19 | + "cube-ui": "^1.12.31", | |
| 17 | 20 | "element-ui": "^2.9.1", |
| 18 | 21 | "font-awesome": "4.7.0", |
| 19 | 22 | "html2canvas": "^1.0.0-rc.3", |
| ... | ... | @@ -22,6 +25,8 @@ |
| 22 | 25 | "qrcode": "^1.4.1", |
| 23 | 26 | "register-service-worker": "^1.6.2", |
| 24 | 27 | "strapi-sdk-javascript": "^0.3.1", |
| 28 | + "stylus": "^0.54.7", | |
| 29 | + "stylus-loader": "^3.0.2", | |
| 25 | 30 | "vue": "^2.6.10", |
| 26 | 31 | "vue-i18n": "^8.14.1", |
| 27 | 32 | "vue-router": "^3.0.3", |
| ... | ... | @@ -43,6 +48,15 @@ |
| 43 | 48 | "eslint-plugin-vue": "^5.0.0", |
| 44 | 49 | "sass": "^1.18.0", |
| 45 | 50 | "sass-loader": "^7.1.0", |
| 51 | + "stylus": "^0.54.5", | |
| 52 | + "stylus-loader": "^3.0.2", | |
| 53 | + "vue-cli-plugin-cube-ui": "^0.2.5", | |
| 46 | 54 | "vue-template-compiler": "^2.6.10" |
| 55 | + }, | |
| 56 | + "transformModules": { | |
| 57 | + "cube-ui": { | |
| 58 | + "transform": "cube-ui/src/modules/${member}", | |
| 59 | + "kebabCase": true | |
| 60 | + } | |
| 47 | 61 | } |
| 48 | 62 | } | ... | ... |
front-end/h5/vue.config.js
| 1 | +const path = require('path') | |
| 1 | 2 | const target = 'http://localhost:1337' |
| 3 | +const engineOutputDir = path.join(__dirname, '../../back-end/h5-api/public/engine-assets') | |
| 4 | + | |
| 5 | +let page | |
| 6 | +switch (process.env.PAGE) { | |
| 7 | + case 'ENGINE': | |
| 8 | + page = { | |
| 9 | + entry: 'src/engine-entry.js', | |
| 10 | + outputDir: engineOutputDir | |
| 11 | + } | |
| 12 | + break | |
| 13 | + case 'EDITOR': | |
| 14 | + default: | |
| 15 | + page = { | |
| 16 | + entry: 'src/main.js', | |
| 17 | + template: 'public/index.html', | |
| 18 | + filename: 'index.html', | |
| 19 | + title: 'Index Page', | |
| 20 | + outputDir: 'dist' | |
| 21 | + } | |
| 22 | +} | |
| 23 | + | |
| 24 | +const configureWebpack = { | |
| 25 | + resolve: { | |
| 26 | + alias: { | |
| 27 | + '@': path.join(__dirname, 'src') | |
| 28 | + } | |
| 29 | + } | |
| 30 | +} | |
| 31 | + | |
| 2 | 32 | module.exports = { |
| 3 | - runtimeCompiler: true, | |
| 4 | - productionSourceMap: false, | |
| 33 | + outputDir: page.outputDir, | |
| 34 | + lintOnSave: process.env.NODE_ENV !== 'production', | |
| 35 | + productionSourceMap: process.env.NODE_ENV !== 'production', | |
| 36 | + pages: { index: page }, | |
| 5 | 37 | devServer: { |
| 6 | 38 | proxy: { |
| 7 | - '/works': { | |
| 8 | - target, | |
| 9 | - changeOrigin: true, | |
| 10 | - ws: false | |
| 11 | - }, | |
| 12 | - '/upload': { | |
| 39 | + '^/upload|content-manager|users-permissions|works|admin|psd-files|workforms|third-libs|engine-assets/': { | |
| 13 | 40 | target, |
| 14 | 41 | changeOrigin: true, |
| 15 | 42 | ws: false |
| 16 | 43 | } |
| 17 | 44 | } |
| 18 | 45 | }, |
| 19 | - pages: { | |
| 20 | - index: { | |
| 21 | - entry: 'src/main.js', | |
| 22 | - template: 'public/index.html', | |
| 23 | - filename: 'index.html', | |
| 24 | - title: 'Index Page' | |
| 46 | + configureWebpack, | |
| 47 | + css: { | |
| 48 | + loaderOptions: { | |
| 49 | + stylus: { | |
| 50 | + 'resolve url': true, | |
| 51 | + 'import': [ | |
| 52 | + // './src/theme' | |
| 53 | + ] | |
| 54 | + } | |
| 55 | + }, | |
| 56 | + extract: false | |
| 57 | + }, | |
| 58 | + pluginOptions: { | |
| 59 | + 'cube-ui': { | |
| 60 | + postCompile: true, | |
| 61 | + theme: true | |
| 25 | 62 | } |
| 26 | - // engine: { | |
| 27 | - // entry: 'src/engine-entry.js' | |
| 28 | - // } | |
| 29 | 63 | } |
| 30 | 64 | } | ... | ... |