UNPKG

3.47 kBPlain TextView Raw
1/**
2 * Created by wuwei on 2017/4/10.
3 */
4/** @type { import('@tuax/types/tuarc').Options } */
5const tuarc = {
6 /**
7 * 配置最终程序要运行的环境,会根据环境打包文件。
8 */
9 env: {
10 /**
11 * 定义浏览器环境,babel-preset-env 插件使用的环境
12 * browsers {Array<string> | string} 浏览器支持
13 * 或者 {
14 * debug: {Array<string> | string}, 浏览器支持
15 * publish: {Array<string> | string} 浏览器支持
16 * }
17 * https://github.com/ai/browserslist http://browserl.ist/
18 * 默认在 debug 阶段只兼容 chrome 的最新两个版本,加快编译速度
19 * 发布阶段兼容情况,
20 * 1. 浏览器最近两个版本
21 * 2. ie9及以上
22 * 3. android 4以上
23 * 4. iOS 7以上
24 *
25 */
26
27 browsers: {
28 debug: 'last 2 Chrome versions',
29 publish: ['last 2 versions', 'not ie <= 8', 'Android > 4', 'iOS > 7'],
30 }
31 },
32 pages: function (params) {
33 // console.log("pageEntries filter:", params)
34 return {
35 index: {
36 // page 的入口
37 entry: './src/index',
38 serverEntry: './src/index.server', //ssr 不能独立于终端的 entry 存在,因此,每一个终端入口 +.server 的方式命名的 js 文件都是此页面的ssr方式的入口
39 // 模板来源
40 template: 'src/index.html',
41 // inlineSource: '.css|js$', // embed all javascript and css inline
42 // 在 dist/index.html 的输出
43 filename: './page/index.html',
44 // 当使用 title 选项时,
45 // template 中的 title 标签需要是 <title><%= htmlWebpackPlugin.options.title %></title>
46 title: 'Index Page',
47 // 在这个页面中包含的块,默认情况下会包含
48 // 提取出来的通用 common, manifest
49 chunks: ['common', 'manifest', 'index']
50 },
51 // 当使用只有入口的字符串 ${pagename}: ${entry} 格式时,
52 // serverEntry: ${entry}.server 如果 ${entry} 以 .js 结尾,去掉 .js, 如果没有,为非同构页面
53 // template: `src/${pagename}.html` 如果找不到,使用 src/default.html 如果还没有,使用 tua 自带默认模板
54 // filename: ${pagename}.html
55 sports: {
56 entry: './src/sports',
57 template: 'src/sports.html'
58 }
59 }
60 },
61 devServer: {
62 localhost: 'omgfront.sports.qq.com'
63 },
64 // enableProfile: true,
65 /**
66 * 执行打包到 toserver 时,静态资源会上传至cdn,此为静态资源文件夹地址
67 */
68 serverUrl: "https://a.com/",
69 //@deprecated
70 // dllchunks: {
71 // vendor: ['./src/lib/utils', '@tua/polyfill'],
72 // vendor2: ['./src/lib/utils'],
73 // },
74 /**
75 * 配置dll块
76 */
77 dll: {
78 chunks: {
79 // vendor: ['./src/lib/utils'],
80 // vendor2: ['./src/lib/utils'],
81 },
82 },
83 plugins: [
84 [require('./plugins/testplugin'), {
85
86 }],
87 require('@tuax/plugin-css-preprocessor'),
88 require('@tuax/plugin-imgmin'),
89 require('@tuax/plugin-profile')
90 ],
91 compileProfile: true
92}
93module.exports = tuarc