0
0

More than 1 year has passed since last update.

Viteでgzipをインポートするプラグイン

Last updated at Posted at 2023-04-01

Viteでgzipファイルを文字列としてインポートするプラグインを作りました。

プラグインの使用

vite.config.ts
import { defineConfig } from 'vite'
import gzipImport from 'path/to/gzip-import'

export default defineConfig({
  plugins: [
    gzipImport(),
  ],
})

gzipファイルを文字列としてインポートする

gzipファイルの末尾に?rawを付与することで(他のアセットと同様に1)文字列としてインポートすることができます。

import file from 'path/to/file.gz?raw'
  1. アセットを文字列としてインポートする

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0