easy-team / easywebpack

A Simple, Powerful Webpack Front-End Development Solution
https://easyjs.cn/easywebpack
MIT License
482 stars 51 forks source link

生产环境打包,script引入js的路径没有替换成绝对路径 #42

Closed countingSta closed 5 years ago

countingSta commented 6 years ago

'use strict'; const path = require('path'); const VueLoaderPlugin = require('vue-loader/lib/plugin'); const optimizeCssAssets = require('optimize-css-assets-webpack-plugin'); const Oss = require('./plugins/oss');

module.exports = { egg: true, framework: 'vue', entry: { include: ['app/web/page'], exclude: ['app/web/page/[a-z]+/(component|store)'], loader: { client: 'app/web/framework/vue/entry/client-loader.ts', server: 'app/web/framework/vue/entry/server-loader.ts' } }, // publicPath: process.env.NODE_ENV === 'production' ? 'https://cdn.dooprime.com/clearing-website/dist/' : '/public/', alias: { server: 'app/web/framework/vue/entry/server.ts', client: 'app/web/framework/vue/entry/client.ts', component: 'app/web/component', framework: 'app/web/framework', }, dll: ['vue'], loaders: { typescript: true, less: true, stylus: true }, plugins: { vueLoader: { name: new VueLoaderPlugin() }, optimizeCssAssets: { name: new optimizeCssAssets(), env: ['prod'] } } }; image

hubcarl commented 6 years ago

@countingSta 不要在publicPath 上面配置cdn这个,另外 process.env.NODE_ENV === 'production' 判断, process.env.NODE_ENV 这个值 你是否有设置? CDN 配置: https://www.yuque.com/easy-team/easywebpack/cdn

hubcarl commented 6 years ago

optimize-css-assets-webpack-plugin 已内置,并开启了,无需配置

hubcarl commented 6 years ago

const VueLoaderPlugin = require('vue-loader/lib/plugin'); 引入这个有什么特殊要求? easywebpack-vue 已经整合了相关插件,从目前使用来看,无需配置其他插件。

hubcarl commented 6 years ago

目前 easywebpack 内置方案是 vue-loader 版本是 14,无需相关插件配置。 15 还需要等一段时间

hubcarl commented 5 years ago

已内置 15