wip
This commit is contained in:
parent
505874a971
commit
6dfeae9dcc
|
@ -1,12 +1,10 @@
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import pluginReplace from '@rollup/plugin-replace';
|
|
||||||
import pluginVue from '@vitejs/plugin-vue';
|
import pluginVue from '@vitejs/plugin-vue';
|
||||||
import { type UserConfig, defineConfig } from 'vite';
|
import { type UserConfig, defineConfig } from 'vite';
|
||||||
|
|
||||||
import locales from '../../locales/index.js';
|
import locales from '../../locales/index.js';
|
||||||
import meta from '../../package.json';
|
import meta from '../../package.json';
|
||||||
import packageInfo from './package.json' with { type: 'json' };
|
import packageInfo from './package.json' with { type: 'json' };
|
||||||
import pluginUnwindCssModuleClassName from './lib/rollup-plugin-unwind-css-module-class-name.js';
|
|
||||||
import pluginJson5 from './vite.json5.js';
|
import pluginJson5 from './vite.json5.js';
|
||||||
|
|
||||||
const extensions = ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.json', '.json5', '.svg', '.sass', '.scss', '.css', '.vue'];
|
const extensions = ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.json', '.json5', '.svg', '.sass', '.scss', '.css', '.vue'];
|
||||||
|
@ -69,28 +67,14 @@ export function getConfig(): UserConfig {
|
||||||
|
|
||||||
plugins: [
|
plugins: [
|
||||||
pluginVue(),
|
pluginVue(),
|
||||||
pluginUnwindCssModuleClassName(),
|
|
||||||
pluginJson5(),
|
pluginJson5(),
|
||||||
...process.env.NODE_ENV === 'production'
|
|
||||||
? [
|
|
||||||
pluginReplace({
|
|
||||||
preventAssignment: true,
|
|
||||||
values: {
|
|
||||||
'isChromatic()': JSON.stringify(false),
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
]
|
|
||||||
: [],
|
|
||||||
],
|
],
|
||||||
|
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions,
|
extensions,
|
||||||
alias: {
|
alias: {
|
||||||
'@/': __dirname + '/src/',
|
'@/': __dirname + '/src/',
|
||||||
'/client-assets/': __dirname + '/assets/',
|
'/static-assets/': __dirname + '/../backend/assets/'
|
||||||
'/static-assets/': __dirname + '/../backend/assets/',
|
|
||||||
'/fluent-emojis/': __dirname + '/../../fluent-emojis/dist/',
|
|
||||||
'/fluent-emoji/': __dirname + '/../../fluent-emojis/dist/',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -113,10 +97,7 @@ export function getConfig(): UserConfig {
|
||||||
_ENV_: JSON.stringify(process.env.NODE_ENV),
|
_ENV_: JSON.stringify(process.env.NODE_ENV),
|
||||||
_DEV_: process.env.NODE_ENV !== 'production',
|
_DEV_: process.env.NODE_ENV !== 'production',
|
||||||
_PERF_PREFIX_: JSON.stringify('Misskey:'),
|
_PERF_PREFIX_: JSON.stringify('Misskey:'),
|
||||||
_DATA_TRANSFER_DRIVE_FILE_: JSON.stringify('mk_drive_file'),
|
__VUE_OPTIONS_API__: false,
|
||||||
_DATA_TRANSFER_DRIVE_FOLDER_: JSON.stringify('mk_drive_folder'),
|
|
||||||
_DATA_TRANSFER_DECK_COLUMN_: JSON.stringify('mk_deck_column'),
|
|
||||||
__VUE_OPTIONS_API__: true,
|
|
||||||
__VUE_PROD_DEVTOOLS__: false,
|
__VUE_PROD_DEVTOOLS__: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -129,14 +110,12 @@ export function getConfig(): UserConfig {
|
||||||
manifest: 'manifest.json',
|
manifest: 'manifest.json',
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
input: {
|
input: {
|
||||||
app: './src/_boot_.ts',
|
app: './src/boot.ts',
|
||||||
embedApp: './src/_embed_boot_.ts',
|
|
||||||
},
|
},
|
||||||
external: externalPackages.map(p => p.match),
|
external: externalPackages.map(p => p.match),
|
||||||
output: {
|
output: {
|
||||||
manualChunks: {
|
manualChunks: {
|
||||||
vue: ['vue'],
|
vue: ['vue'],
|
||||||
photoswipe: ['photoswipe', 'photoswipe/lightbox', 'photoswipe/style.css'],
|
|
||||||
},
|
},
|
||||||
chunkFileNames: process.env.NODE_ENV === 'production' ? '[hash:8].js' : '[name]-[hash:8].js',
|
chunkFileNames: process.env.NODE_ENV === 'production' ? '[hash:8].js' : '[name]-[hash:8].js',
|
||||||
assetFileNames: process.env.NODE_ENV === 'production' ? '[hash:8][extname]' : '[name]-[hash:8][extname]',
|
assetFileNames: process.env.NODE_ENV === 'production' ? '[hash:8][extname]' : '[name]-[hash:8][extname]',
|
||||||
|
@ -160,28 +139,13 @@ export function getConfig(): UserConfig {
|
||||||
|
|
||||||
// https://vitejs.dev/guide/dep-pre-bundling.html#monorepos-and-linked-dependencies
|
// https://vitejs.dev/guide/dep-pre-bundling.html#monorepos-and-linked-dependencies
|
||||||
commonjsOptions: {
|
commonjsOptions: {
|
||||||
include: [/misskey-js/, /misskey-reversi/, /misskey-bubble-game/, /node_modules/],
|
include: [/misskey-js/, /node_modules/],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
worker: {
|
worker: {
|
||||||
format: 'es',
|
format: 'es',
|
||||||
},
|
},
|
||||||
|
|
||||||
test: {
|
|
||||||
environment: 'happy-dom',
|
|
||||||
deps: {
|
|
||||||
optimizer: {
|
|
||||||
web: {
|
|
||||||
include: [
|
|
||||||
// XXX: misskey-dev/browser-image-resizer has no "type": "module"
|
|
||||||
'browser-image-resizer',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
includeSource: ['src/**/*.ts'],
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,6 @@ export function getConfig(): UserConfig {
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
input: {
|
input: {
|
||||||
app: './src/_boot_.ts',
|
app: './src/_boot_.ts',
|
||||||
embedApp: './src/_embed_boot_.ts',
|
|
||||||
},
|
},
|
||||||
external: externalPackages.map(p => p.match),
|
external: externalPackages.map(p => p.match),
|
||||||
output: {
|
output: {
|
||||||
|
|
Loading…
Reference in New Issue