Newer
Older
import I18nReplacer from './src/build/i18n';
import { pattern as faPattern, replacement as faReplacement } from './src/build/fa';
collapseWhitespace: true,
collapseInlineTagWhitespace: true,
keepClosingSlash: true
}).replace(/\t/g, '');
};
global['base64replacement'] = (_, key) => {
// 無圧縮スクリプトを用意するのは重いので一時的に無効化
//const entries = process.env.NODE_ENV == 'production'
// ? langs.map(l => [l, false]).concat(langs.map(l => [l, true]))
// : langs.map(l => [l, false]);
// Chunk name
const name = lang;
// Entries
const entry = {
desktop: './src/client/app/desktop/script.ts',
mobile: './src/client/app/mobile/script.ts',
//ch: './src/client/app/ch/script.ts',
//stats: './src/client/app/stats/script.ts',
//status: './src/client/app/status/script.ts',
dev: './src/client/app/dev/script.ts',
auth: './src/client/app/auth/script.ts',
sw: './src/client/app/sw.js'
//#region Define consts
const consts = {
_RECAPTCHA_SITEKEY_: config.recaptcha.site_key,
_SW_PUBLICKEY_: config.sw ? config.sw.public_key : null,
_THEME_COLOR_: constants.themeColor,
_COPYRIGHT_: constants.copyright,
_VERSION_: version,
_STATUS_URL_: config.status_url,
_STATS_URL_: config.stats_url,
_DOCS_URL_: config.docs_url,
_API_URL_: config.api_url,
_URL_: config.url,
_LICENSE_: licenseHtml,
_GOOGLE_MAPS_API_KEY_: config.google_maps_api_key
};
const _consts = {};
Object.keys(consts).forEach(key => {
_consts[key] = JSON.stringify(consts[key]);
});
//#endregion
const plugins = [
new ProgressBarPlugin({
format: chalk` {cyan.bold yes we can} {bold [}:bar{bold ]} {green.bold :percent} {gray (:current/:total)} :elapseds`,
clear: false
}),
new webpack.DefinePlugin(_consts),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(isProduction ? 'production' : 'development')
fs.writeFileSync('./built/client/meta.json', JSON.stringify({
loader: 'vue-loader',
options: {
cssSourceMap: false,
preserveWhitespace: false
}
}, {
loader: 'replace',
query: {
search: /%base64:(.+?)%/g.toString(),
replace: 'base64replacement'
}
}, {
loader: 'replace',
query: {
search: i18nReplacer.pattern.toString(),
}
}, {
loader: 'replace',
query: {
search: faPattern.toString(),
replace: 'faReplacement'
}
}, {
loader: 'replace',
query: {
search: /^<template>([\s\S]+?)\r?\n<\/template>/.toString(),
replace: 'collapseSpacesReplacement'
}
use: [{
loader: 'style-loader'
}, {
loader: 'css-loader',
options: {
minimize: true
}
}, {
loader: 'stylus-loader'
}, {
test: /\.scss$/,
exclude: /node_modules/,
use: [{
loader: 'style-loader'
}, {
}, {
loader: 'sass-loader',
options: {
importer: jsonImporter,
}
}]
use: [{
loader: 'style-loader'
}, {
loader: 'css-loader',
options: {
minimize: true
}
}]
appendTsSuffixTo: [/\.vue$/]
}
}, {
loader: 'replace',
query: {
search: i18nReplacer.pattern.toString(),
}
}, {
loader: 'replace',
query: {
search: faPattern.toString(),
replace: 'faReplacement'
}
}]