/** * Created by wuwei on 2017/4/10. */ /** @type { import('@tuax/types/tuarc').Options } */ const tuarc = { /** * 配置最终程序要运行的环境,会根据环境打包文件。 */ env: { /** * 定义浏览器环境,babel-preset-env 插件使用的环境 * browsers {Array | string} 浏览器支持 * 或者 { * debug: {Array | string}, 浏览器支持 * publish: {Array | string} 浏览器支持 * } * https://github.com/ai/browserslist http://browserl.ist/ * 默认在 debug 阶段只兼容 chrome 的最新两个版本,加快编译速度 * 发布阶段兼容情况, * 1. 浏览器最近两个版本 * 2. ie9及以上 * 3. android 4以上 * 4. iOS 7以上 * */ browsers: { debug: 'last 2 Chrome versions', publish: ['last 2 versions', 'not ie <= 8', 'Android > 4', 'iOS > 7'], } }, pages: function (params) { // console.log("pageEntries filter:", params) return { index: { // page 的入口 entry: './src/index', serverEntry: './src/index.server', //ssr 不能独立于终端的 entry 存在,因此,每一个终端入口 +.server 的方式命名的 js 文件都是此页面的ssr方式的入口 // 模板来源 template: 'src/index.html', // inlineSource: '.css|js$', // embed all javascript and css inline // 在 dist/index.html 的输出 filename: './page/index.html', // 当使用 title 选项时, // template 中的 title 标签需要是 <%= htmlWebpackPlugin.options.title %> title: 'Index Page', // 在这个页面中包含的块,默认情况下会包含 // 提取出来的通用 common, manifest chunks: ['common', 'manifest', 'index'] }, // 当使用只有入口的字符串 ${pagename}: ${entry} 格式时, // serverEntry: ${entry}.server 如果 ${entry} 以 .js 结尾,去掉 .js, 如果没有,为非同构页面 // template: `src/${pagename}.html` 如果找不到,使用 src/default.html 如果还没有,使用 tua 自带默认模板 // filename: ${pagename}.html sports: { entry: './src/sports', template: 'src/sports.html' } } }, devServer: { localhost: 'omgfront.sports.qq.com' }, // enableProfile: true, /** * 执行打包到 toserver 时,静态资源会上传至cdn,此为静态资源文件夹地址 */ serverUrl: "https://a.com/", //@deprecated // dllchunks: { // vendor: ['./src/lib/utils', '@tua/polyfill'], // vendor2: ['./src/lib/utils'], // }, /** * 配置dll块 */ dll: { chunks: { // vendor: ['./src/lib/utils'], // vendor2: ['./src/lib/utils'], }, }, plugins: [ [require('./plugins/testplugin'), { }], require('@tuax/plugin-css-preprocessor'), require('@tuax/plugin-imgmin'), require('@tuax/plugin-profile') ], compileProfile: true } module.exports = tuarc