0.1.3 • Published 12 months ago

unplugin-pixi-assets v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

unplugin-pixi-assets

NPM version

Type safe Assets in pixi.js

Install

npm i unplugin-pixi-assets
// vite.config.ts
import PixiAssets from 'unplugin-pixi-assets/vite'

export default defineConfig({
  plugins: [
    PixiAssets({ /* options */ }),
  ],
})

Example: playground/

// rollup.config.js
import PixiAssets from 'unplugin-pixi-assets/rollup'

export default {
  plugins: [
    PixiAssets({ /* options */ }),
  ],
}

// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('unplugin-pixi-assets/webpack')({ /* options */ })
  ]
}

// nuxt.config.js
export default defineNuxtConfig({
  modules: [
    ['unplugin-pixi-assets/nuxt', { /* options */ }],
  ],
})

This module works for both Nuxt 2 and Nuxt Vite

// vue.config.js
module.exports = {
  configureWebpack: {
    plugins: [
      require('unplugin-pixi-assets/webpack')({ /* options */ }),
    ],
  },
}

// esbuild.config.js
import { build } from 'esbuild'
import PixiAssets from 'unplugin-pixi-assets/esbuild'

build({
  plugins: [PixiAssets()],
})

Setup

If you have an env.d.ts file, add the unplugin-pixi-assets types to it.

// env.d.ts
/// <reference types="vite/client" />
/// <reference types="unplugin-pixi-assets/client" />

If you don't have an env.d.ts file, you can create one and add the unplugin-pixi-assets types to it or you can add them to the types property in your tsconfig.json:

{
  "compilerOptions": {
    // ...
    "types": ["unplugin-pixi-assets/client"]
  }
}