Authored by 陈峰

commit

export default [{
path: '/ufo/order/:orderId(\\d+)',
name: 'order',
component: () => import('./order')
component: () => import(/* webpackChunkName: "order" */ './order')
}];
... ...
const webpack = require('webpack');
const path = require('path');
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
var PostCompilePlugin = require('webpack-post-compile-plugin')
var TransformModulesPlugin = require('webpack-transform-modules-plugin')
var PostCompilePlugin = require('webpack-post-compile-plugin');
var TransformModulesPlugin = require('webpack-transform-modules-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const pkg = require('../package.json');
const isProd = process.env.NODE_ENV === 'production';
... ... @@ -47,47 +46,6 @@ const webpackConfig = {
test: /\.js$/,
use: 'babel-loader',
exclude: /node_modules/
}, {
test: /\.s?css$/,
use: [
isProd ? MiniCssExtractPlugin.loader : 'vue-style-loader',
'css-loader',
'postcss-loader',
{
loader: 'sass-loader',
options: {
sourceMap: isProd
}
}]
}, {
test: /\.styl(us)?$/,
use: [
isProd ? MiniCssExtractPlugin.loader : 'vue-style-loader',
'css-loader',
'postcss-loader',
{
loader: 'stylus-loader',
options: {
sourceMap: isProd,
'resolve url': true
}
}]
}, {
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
use: {
loader: 'file-loader',
options: {
name: 'static/img/[name].[hash:7].[ext]'
}
}
}, {
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
use: {
loader: 'file-loader',
options: {
name: 'static/img/[name].[hash:7].[ext]'
}
}
},
]
},
... ... @@ -100,13 +58,6 @@ const webpackConfig = {
]
};
if (isProd) {
webpackConfig.plugins.push(
new MiniCssExtractPlugin({
filename: 'static/css/[name].[contenthash].css',
allChunks: true
})
);
}
module.exports = webpackConfig;
... ...
const webpack = require('webpack');
const merge = require('webpack-merge');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const VueSSRClientPlugin = require('vue-server-renderer/client-plugin');
const pkg = require('../package.json');
let baseConfig = require('./webpack.base.conf');
const isProd = process.env.NODE_ENV === 'production';
const webpackConfig = merge(baseConfig, {
entry: {
... ... @@ -43,6 +45,52 @@ const webpackConfig = merge(baseConfig, {
}
}
},
module: {
rules: [
{
test: /\.s?css$/,
use: [
isProd ? MiniCssExtractPlugin.loader : 'vue-style-loader',
'css-loader',
'postcss-loader',
{
loader: 'sass-loader',
options: {
sourceMap: isProd
}
}]
}, {
test: /\.styl(us)?$/,
use: [
isProd ? MiniCssExtractPlugin.loader : 'vue-style-loader',
'css-loader',
'postcss-loader',
{
loader: 'stylus-loader',
options: {
sourceMap: isProd,
'resolve url': true
}
}]
}, {
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
use: {
loader: 'file-loader',
options: {
name: 'static/img/[name].[hash:7].[ext]'
}
}
}, {
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
use: {
loader: 'file-loader',
options: {
name: 'static/img/[name].[hash:7].[ext]'
}
}
}
]
},
resolve: {
alias: {
'create-api': 'common/create-api-client.js'
... ... @@ -61,5 +109,12 @@ const webpackConfig = merge(baseConfig, {
if (process.argv.some(a => a === '--report')) {
webpackConfig.plugins.push(new BundleAnalyzerPlugin());
}
if (isProd) {
webpackConfig.plugins.push(
new MiniCssExtractPlugin({
filename: 'static/css/[name].[contenthash].css',
allChunks: true
})
);
}
module.exports = webpackConfig;
... ...
... ... @@ -17,11 +17,28 @@ let webpackConfig = merge(baseConfig, {
'create-api': 'common/create-api-server.js'
}
},
module: {
rules: [
{
test: /\.s?css$/,
use: 'ignore-loader'
}, {
test: /\.styl(us)?$/,
use: 'ignore-loader'
}, {
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
use: 'ignore-loader'
}, {
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
use: 'ignore-loader'
}
]
},
output: {
libraryTarget: 'commonjs2',
},
externals: nodeExternals({
whitelist: [/\.css$/, /cube-ui/]
whitelist: [/cube-ui/]
}),
plugins: [
new VueSSRServerPlugin({
... ...
... ... @@ -57,7 +57,7 @@ module.exports = {
activity: '//activity.yohobuy.com',
index: '//m.yohobuy.com'
},
useCache: true,
useCache: false,
loggers: {
infoFile: {
close: true,
... ... @@ -99,7 +99,6 @@ module.exports = {
// host: '127.0.0.1',
port: '6379',
password: '',
enable_offline_queue: false,
retry_strategy(options) {
if (options.error && options.error.code === 'ECONNREFUSED') {
... ... @@ -214,7 +213,7 @@ if (isProduction) {
ufo: process.env.UFO_API || 'http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway/',
service: process.env.TEST_API || 'http://api-test3.dev.yohocorp.com/'
},
useCache: true,
useCache: false,
monitorReport: {
host: '192.168.102.22',
port: 8086,
... ...
... ... @@ -7,6 +7,7 @@ const yohoLib = require('yoho-node-lib');
const pkg = require('./package.json');
const devtools = require('./doraemon/middleware/devtools');
const _ = require('lodash');
const Express = require('express');
// 全局注册library
yohoLib.global(config);
... ... @@ -35,6 +36,8 @@ exports.createApp = async(app) => {
// 添加请求上下文
app.use(global.yoho.httpCtx());
app.use('/static', Express.static('./dist/yohoblk-wap/bundle/static'));
app.use(global.yoho.hbs({
extname: '.hbs',
defaultLayout: 'layout',
... ...
... ... @@ -82,6 +82,7 @@
"file-loader": "^2.0.0",
"friendly-errors-webpack-plugin": "^1.7.0",
"husky": "^1.2.0",
"ignore-loader": "^0.1.2",
"memory-fs": "^0.4.1",
"mini-css-extract-plugin": "^0.5.0",
"node-sass": "^4.11.0",
... ...
... ... @@ -3335,6 +3335,10 @@ ignore-by-default@^1.0.1:
version "1.0.1"
resolved "http://npm.yohops.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09"
ignore-loader@^0.1.2:
version "0.1.2"
resolved "http://npm.yohops.com/ignore-loader/-/ignore-loader-0.1.2.tgz#d81f240376d0ba4f0d778972c3ad25874117a463"
ignore-walk@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.1.tgz#a83e62e7d272ac0e3b551aaa82831a19b69f82f8"
... ...