diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2020-01-30 04:37:25 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-30 04:37:25 +0900 |
| commit | f6154dc0af1a0d65819e87240f4385f9573095cb (patch) | |
| tree | 699a5ca07d6727b7f8497d4769f25d6d62f94b5a /webpack.config.ts | |
| parent | Add Event activity-type support (#5785) (diff) | |
| download | sharkey-f6154dc0af1a0d65819e87240f4385f9573095cb.tar.gz sharkey-f6154dc0af1a0d65819e87240f4385f9573095cb.tar.bz2 sharkey-f6154dc0af1a0d65819e87240f4385f9573095cb.zip | |
v12 (#5712)
Co-authored-by: MeiMei <30769358+mei23@users.noreply.github.com>
Co-authored-by: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com>
Diffstat (limited to 'webpack.config.ts')
| -rw-r--r-- | webpack.config.ts | 54 |
1 files changed, 25 insertions, 29 deletions
diff --git a/webpack.config.ts b/webpack.config.ts index 195773f33b..bec2093d57 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -6,7 +6,6 @@ import * as fs from 'fs'; import * as webpack from 'webpack'; import * as chalk from 'chalk'; const { VueLoaderPlugin } = require('vue-loader'); -const HardSourceWebpackPlugin = require('hard-source-webpack-plugin'); const ProgressBarPlugin = require('progress-bar-webpack-plugin'); const TerserPlugin = require('terser-webpack-plugin'); @@ -20,13 +19,9 @@ class WebpackOnBuildPlugin { } const isProduction = process.env.NODE_ENV == 'production'; -const useHardSource = process.env.MISSKEY_USE_HARD_SOURCE; - -const constants = require('./src/const.json'); const locales = require('./locales'); const meta = require('./package.json'); -const codename = meta.codename; const postcss = { loader: 'postcss-loader', @@ -41,12 +36,8 @@ const postcss = { module.exports = { entry: { - desktop: './src/client/app/desktop/script.ts', - mobile: './src/client/app/mobile/script.ts', - dev: './src/client/app/dev/script.ts', - auth: './src/client/app/auth/script.ts', - admin: './src/client/app/admin/script.ts', - sw: './src/client/app/sw.js' + app: './src/client/init.ts', + sw: './src/client/sw.js' }, module: { rules: [{ @@ -64,7 +55,7 @@ module.exports = { loader: 'vue-svg-inline-loader' }] }, { - test: /\.styl(us)?$/, + test: /\.scss?$/, exclude: /node_modules/, oneOf: [{ resourceQuery: /module/, @@ -76,7 +67,13 @@ module.exports = { modules: true } }, postcss, { - loader: 'stylus-loader' + loader: 'sass-loader', + options: { + implementation: require('sass'), + sassOptions: { + fiber: require('fibers') + } + } }] }, { use: [{ @@ -84,7 +81,13 @@ module.exports = { }, { loader: 'css-loader' }, postcss, { - loader: 'stylus-loader' + loader: 'sass-loader', + options: { + implementation: require('sass'), + sassOptions: { + fiber: require('fibers') + } + } }] }] }, { @@ -107,42 +110,32 @@ module.exports = { loader: 'ts-loader', options: { happyPackMode: true, - configFile: __dirname + '/src/client/app/tsconfig.json', + transpileOnly: true, + configFile: __dirname + '/src/client/tsconfig.json', appendTsSuffixTo: [/\.vue$/] } }] }] }, plugins: [ - ...(useHardSource ? [new HardSourceWebpackPlugin()] : []), new ProgressBarPlugin({ - format: chalk` {cyan.bold yes we can} {bold [}:bar{bold ]} {green.bold :percent} {gray (:current/:total)} :elapseds`, + format: chalk` {cyan.bold Yes we can} {bold [}:bar{bold ]} {green.bold :percent} {gray :elapseds}`, clear: false }), new webpack.DefinePlugin({ - _COPYRIGHT_: JSON.stringify(constants.copyright), _VERSION_: JSON.stringify(meta.version), - _CODENAME_: JSON.stringify(codename), _LANGS_: JSON.stringify(Object.entries(locales).map(([k, v]: [string, any]) => [k, v && v.meta && v.meta.lang])), _ENV_: JSON.stringify(process.env.NODE_ENV) }), - new webpack.DefinePlugin({ - 'process.env.NODE_ENV': JSON.stringify(isProduction ? 'production' : 'development') - }), + new VueLoaderPlugin(), new WebpackOnBuildPlugin((stats: any) => { fs.writeFileSync('./built/meta.json', JSON.stringify({ version: meta.version }), 'utf-8'); - - fs.mkdirSync('./built/client/assets/locales', { recursive: true }); - - for (const [lang, locale] of Object.entries(locales)) - fs.writeFileSync(`./built/client/assets/locales/${lang}.json`, JSON.stringify(locale), 'utf-8'); }), - new VueLoaderPlugin(), - new webpack.optimize.ModuleConcatenationPlugin() ], output: { path: __dirname + '/built/client/assets', filename: `[name].${meta.version}.js`, + chunkFilename: '[hash:5].[id].js', publicPath: `/assets/` }, resolve: { @@ -156,6 +149,9 @@ module.exports = { resolveLoader: { modules: ['node_modules'] }, + externals: { + moment: 'moment' + }, optimization: { minimizer: [new TerserPlugin()] }, |