From fe98dd927de6906671dfd3aa9671080ab6a065c6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 7 Oct 2017 06:58:50 +0900 Subject: :v: --- webpack/module/rules/index.ts | 4 +++- webpack/module/rules/typescript.ts | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 webpack/module/rules/typescript.ts (limited to 'webpack') diff --git a/webpack/module/rules/index.ts b/webpack/module/rules/index.ts index 2308f4e535..2707a9c2f1 100644 --- a/webpack/module/rules/index.ts +++ b/webpack/module/rules/index.ts @@ -2,10 +2,12 @@ import i18n from './i18n'; import themeColor from './theme-color'; import tag from './tag'; import stylus from './stylus'; +import typescript from './typescript'; export default (lang, locale) => [ i18n(lang, locale), themeColor(), tag(), - stylus() + stylus(), + typescript() ]; diff --git a/webpack/module/rules/typescript.ts b/webpack/module/rules/typescript.ts new file mode 100644 index 0000000000..eb2b279a55 --- /dev/null +++ b/webpack/module/rules/typescript.ts @@ -0,0 +1,8 @@ +/** + * TypeScript + */ + +export default () => ({ + test: /\.ts$/, + use: 'awesome-typescript-loader' +}); -- cgit v1.2.3-freya From 5f40e7eaa46fd8a3f60d2306a21364e38db73012 Mon Sep 17 00:00:00 2001 From: こぴなたみぽ Date: Sun, 22 Oct 2017 14:11:28 +0900 Subject: オフラインでも画像を表示できるようにbase64にして埋め込むようにした MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/web/app/common/tags/error.tag | 2 +- webpack/module/rules/base64.ts | 19 +++++++++++++++++++ webpack/module/rules/index.ts | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 webpack/module/rules/base64.ts (limited to 'webpack') diff --git a/src/web/app/common/tags/error.tag b/src/web/app/common/tags/error.tag index e4e0272a49..a06f17cd1c 100644 --- a/src/web/app/common/tags/error.tag +++ b/src/web/app/common/tags/error.tag @@ -1,5 +1,5 @@ - +

%i18n:common.tags.mk-error.title%

%i18n:common.tags.mk-error.description%

%i18n:common.tags.mk-error.thanks%

diff --git a/webpack/module/rules/base64.ts b/webpack/module/rules/base64.ts new file mode 100644 index 0000000000..529816bd20 --- /dev/null +++ b/webpack/module/rules/base64.ts @@ -0,0 +1,19 @@ +/** + * Replace base64 symbols + */ + +import * as fs from 'fs'; +const StringReplacePlugin = require('string-replace-webpack-plugin'); + +export default () => ({ + enforce: 'pre', + test: /\.(tag|js)$/, + exclude: /node_modules/, + loader: StringReplacePlugin.replace({ + replacements: [{ + pattern: /%base64:(.+?)%/g, replacement: (_, key) => { + return fs.readFileSync(__dirname + '/../../../src/web/' + key, 'base64'); + } + }] + }) +}); diff --git a/webpack/module/rules/index.ts b/webpack/module/rules/index.ts index 2707a9c2f1..9c1262b3d6 100644 --- a/webpack/module/rules/index.ts +++ b/webpack/module/rules/index.ts @@ -1,4 +1,5 @@ import i18n from './i18n'; +import base64 from './base64'; import themeColor from './theme-color'; import tag from './tag'; import stylus from './stylus'; @@ -6,6 +7,7 @@ import typescript from './typescript'; export default (lang, locale) => [ i18n(lang, locale), + base64(), themeColor(), tag(), stylus(), -- cgit v1.2.3-freya From 866d5428bcb06b4978f8039fe7197c560559d1aa Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 22 Oct 2017 15:01:02 +0900 Subject: Use uglifyjs-webpack-plugin instead of uglify-es-webpack-plugin Because uglify-es-webpack-plugin is now deprecated --- package.json | 8 ++++---- webpack/plugins/index.ts | 8 +++----- webpack/plugins/minify.ts | 4 ++-- 3 files changed, 9 insertions(+), 11 deletions(-) (limited to 'webpack') diff --git a/package.json b/package.json index e6fc742913..befa8b2b4e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "misskey", "author": "syuilo ", - "version": "0.0.2584", + "version": "0.0.2732", "license": "MIT", "description": "A miniblog-based SNS", "bugs": "https://github.com/syuilo/misskey/issues", @@ -64,7 +64,7 @@ "@types/webpack": "3.0.13", "@types/webpack-stream": "3.2.7", "@types/websocket": "0.0.34", - "awesome-typescript-loader": "^3.2.3", + "awesome-typescript-loader": "3.2.3", "chai": "4.1.2", "chai-http": "3.0.0", "css-loader": "0.28.7", @@ -90,8 +90,8 @@ "swagger-jsdoc": "1.9.7", "tslint": "5.7.0", "uglify-es": "3.0.27", - "uglify-es-webpack-plugin": "0.10.0", "uglify-js": "git+https://github.com/mishoo/UglifyJS2.git#harmony", + "uglifyjs-webpack-plugin": "1.0.0-beta.2", "webpack": "3.8.1" }, "dependencies": { @@ -109,7 +109,7 @@ "debug": "3.1.0", "deep-equal": "1.0.1", "deepcopy": "0.6.3", - "diskusage": "^0.2.2", + "diskusage": "0.2.2", "download": "6.2.5", "elasticsearch": "13.3.1", "escape-regexp": "0.0.1", diff --git a/webpack/plugins/index.ts b/webpack/plugins/index.ts index 99b16c2b05..d5191f1555 100644 --- a/webpack/plugins/index.ts +++ b/webpack/plugins/index.ts @@ -2,13 +2,11 @@ const StringReplacePlugin = require('string-replace-webpack-plugin'); import constant from './const'; import hoist from './hoist'; -//import minify from './minify'; +import minify from './minify'; import banner from './banner'; -/* const env = process.env.NODE_ENV; const isProduction = env === 'production'; -*/ export default version => { const plugins = [ @@ -16,11 +14,11 @@ export default version => { new StringReplacePlugin(), hoist() ]; -/* + if (isProduction) { plugins.push(minify()); } -*/ + plugins.push(banner(version)); return plugins; diff --git a/webpack/plugins/minify.ts b/webpack/plugins/minify.ts index ec4c9b3405..e46d4c5a10 100644 --- a/webpack/plugins/minify.ts +++ b/webpack/plugins/minify.ts @@ -1,3 +1,3 @@ -const UglifyEsPlugin = require('uglify-es-webpack-plugin'); +const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); -export default () => new UglifyEsPlugin(); +export default () => new UglifyJsPlugin(); -- cgit v1.2.3-freya