From 86d4449db4cfef61f9a23c17b405eb883dd91875 Mon Sep 17 00:00:00 2001 From: DarkSky Date: Wed, 24 Aug 2022 04:14:14 +0800 Subject: [PATCH] chore: ci fix & module split --- apps/ligo-virgo/webpack.config.js | 23 ++++++++----- apps/venus/webpack.config.js | 33 ++++--------------- libs/datasource/jwt/src/adapter/yjs/binary.ts | 9 ++--- 3 files changed, 26 insertions(+), 39 deletions(-) diff --git a/apps/ligo-virgo/webpack.config.js b/apps/ligo-virgo/webpack.config.js index 4bf721409c..11be2e1c76 100644 --- a/apps/ligo-virgo/webpack.config.js +++ b/apps/ligo-virgo/webpack.config.js @@ -43,6 +43,7 @@ module.exports = function (webpackConfig) { ...config.output, filename: '[name].[contenthash:8].js', chunkFilename: '[name].[chunkhash:8].js', + hashDigestLength: 8, hashFunction: undefined, }; config.optimization = { @@ -67,21 +68,21 @@ module.exports = function (webpackConfig) { chunks: 'all', enforce: true, }, - auth: { - test: /[\\/]node_modules[\\/](@authing|@?firebase)/, - name: 'auth', - priority: -5, - chunks: 'all', - }, + // auth: { + // test: /[\\/]node_modules[\\/](@authing|@?firebase)/, + // name: 'auth', + // priority: -5, + // chunks: 'all', + // }, edgeless: { test: /(libs\/components\/board-|[\\/]node_modules[\\/]@tldraw)/, name: 'edgeless', priority: -7, chunks: 'all', }, - editor: { + paper: { test: /(libs\/framework\/(ligo|virgo|editor)|[\\/]node_modules[\\/](@codemirror|@lezer|slate))/, - name: 'editor', + name: 'paper', priority: -8, chunks: 'all', }, @@ -176,7 +177,11 @@ module.exports = function (webpackConfig) { publicPath: '/', }), new Style9Plugin(), - isProd && new MiniCssExtractPlugin(), + isProd && + new MiniCssExtractPlugin({ + filename: '[name].[contenthash:8].css', + chunkFilename: '[id].[chunkhash:8].css', + }), isProd && new CompressionPlugin({ test: /\.(js|css|html|svg|ttf|woff)$/, diff --git a/apps/venus/webpack.config.js b/apps/venus/webpack.config.js index def037d387..57c78f9f3b 100644 --- a/apps/venus/webpack.config.js +++ b/apps/venus/webpack.config.js @@ -39,6 +39,7 @@ module.exports = function (webpackConfig) { ...config.output, filename: '[name].[contenthash:8].js', chunkFilename: '[name].[chunkhash:8].js', + hashDigestLength: 8, hashFunction: undefined, }; config.optimization = { @@ -98,22 +99,7 @@ module.exports = function (webpackConfig) { }, ], }); - config.module.rules.unshift({ - test: /\.scss$/i, - use: [ - 'style-loader', - { - loader: 'css-loader', - options: { - sourceMap: false, - }, - }, - { - loader: 'postcss-loader', - }, - ], - }); - config.module.rules.splice(6); + config.module.rules.splice(4); } else { config.output = { ...config.output, @@ -155,7 +141,11 @@ module.exports = function (webpackConfig) { template: path.resolve(__dirname, './src/template.html'), publicPath: '/', }), - isProd && new MiniCssExtractPlugin(), + isProd && + new MiniCssExtractPlugin({ + filename: '[name].[contenthash:8].css', + chunkFilename: '[id].[chunkhash:8].css', + }), isProd && new CompressionPlugin({ test: /\.(js|css|html|svg|ttf|woff)$/, @@ -201,15 +191,6 @@ const addEmotionBabelPlugin = config => { // See https://github.com/mui/material-ui/issues/27380#issuecomment-928973157 // See https://github.com/emotion-js/emotion/tree/main/packages/babel-plugin#importmap importMap: { - '@toeverything/components/ui': { - styled: { - canonicalImport: ['@emotion/styled', 'default'], - styledBaseImport: [ - '@toeverything/components/ui', - 'styled', - ], - }, - }, '@mui/material': { styled: { canonicalImport: ['@emotion/styled', 'default'], diff --git a/libs/datasource/jwt/src/adapter/yjs/binary.ts b/libs/datasource/jwt/src/adapter/yjs/binary.ts index 468710ac4a..26f82684af 100644 --- a/libs/datasource/jwt/src/adapter/yjs/binary.ts +++ b/libs/datasource/jwt/src/adapter/yjs/binary.ts @@ -1,15 +1,16 @@ import { Array as YArray, Map as YMap } from 'yjs'; -import { RemoteKvService } from '@toeverything/datasource/remote-kv'; +import type { RemoteKvService } from '@toeverything/datasource/remote-kv'; export class YjsRemoteBinaries { private readonly _binaries: YMap>; // binary instance private readonly _remoteStorage?: RemoteKvService; - constructor(binaries: YMap>, remote_token?: string) { + constructor(binaries: YMap>, remoteToken?: string) { this._binaries = binaries; - if (remote_token) { - this._remoteStorage = new RemoteKvService(remote_token); + if (remoteToken) { + // TODO: remote kv need to refactor, we may use cloudflare kv + // this._remoteStorage = new RemoteKvService(remote_token); } else { console.warn(`Remote storage is not ready`); }