1 | 'use strict'
|
2 |
|
3 | const fs = require('fs')
|
4 | const paths = require('./paths')
|
5 | const getEnv = require('./env')
|
6 | const { ensureSlash, camelName } = require('../libs/utils')
|
7 | const defConf = require('./default')
|
8 | const maraConf = require(paths.marauder)
|
9 | const pkgName = require(paths.packageJson).name
|
10 | const maraVersion = require(paths.ownPackageJson).version
|
11 | const useTypeScript = fs.existsSync(paths.tsConfig)
|
12 |
|
13 | function getServedPath(publicUrl) {
|
14 |
|
15 | return publicUrl ? ensureSlash(publicUrl, true) : '/'
|
16 | }
|
17 |
|
18 | const publicPath = getServedPath(maraConf.publicPath)
|
19 | const publicDevPath = getServedPath(maraConf.publicDevPath)
|
20 |
|
21 | module.exports = {
|
22 |
|
23 |
|
24 | hash: {
|
25 | main: true,
|
26 | chunk: true,
|
27 | assets: true
|
28 | },
|
29 | version: maraVersion,
|
30 | debug: maraConf.debug,
|
31 | library: {
|
32 | root: 'MyLibrary',
|
33 | amd: pkgName,
|
34 | commonjs: pkgName
|
35 | },
|
36 | assetsDir: 'static',
|
37 |
|
38 | compiler: Object.assign({}, defConf.compiler, maraConf.compiler),
|
39 | entry: defConf.esm.entry,
|
40 |
|
41 | esm: defConf.esm,
|
42 |
|
43 | vendor: [],
|
44 | paths: paths,
|
45 | useTypeScript,
|
46 | build: {
|
47 | env: getEnv(publicPath.slice(0, -1)),
|
48 | assetsPublicPath: publicPath,
|
49 |
|
50 |
|
51 |
|
52 |
|
53 | bundleAnalyzerReport: process.env.npm_config_report,
|
54 |
|
55 |
|
56 |
|
57 | uploadFtp: process.env.npm_config_ftp,
|
58 | testDeploy: process.env.npm_config_test
|
59 | },
|
60 | dev: {
|
61 | env: getEnv(publicDevPath.slice(0, -1)),
|
62 | port: defConf.dev.port,
|
63 | assetsPublicPath: publicDevPath,
|
64 | proxyTable: {},
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 | cssSourceMap: false
|
71 | },
|
72 | ftp: Object.assign({}, defConf.ftp, maraConf.ftp),
|
73 | ciConfig: Object.assign({}, defConf.ciConfig, maraConf.ciConfig),
|
74 |
|
75 | hybrid: defConf.hybrid,
|
76 | postcss: defConf.postcss
|
77 | }
|