Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite js instead of webpack #5

Open
pytoncraft2 opened this issue Apr 9, 2023 · 0 comments
Open

Vite js instead of webpack #5

pytoncraft2 opened this issue Apr 9, 2023 · 0 comments

Comments

@pytoncraft2
Copy link

Hello !

I want to use vite.js instead of webpack for my project, i found this config who can work but i'm not totaly sure !
If it works, would it be possible to make a starter template with vite.js ? (or replace this existing one maybe)

The index.html file must also be moved to the root of the project

// content of vite.config.js file which replaces webpack.config.js file
import { defineConfig } from 'vite'
const path = require('path')

// https://vitejs.dev/config/
export default defineConfig({
  publicDir: "static",
  build: {
    outDir: 'dist',
    assetsDir: 'asset-packs',
    minify: false,
    sourcemap: false,
    chunkSizeWarningLimit: 2000,
  },
  resolve:{
    alias:{
      '@' : path.resolve(__dirname, './static')
    },
  },
  server: {
    host: true
  }
})

my new package.json file :

{
  "name": "phaser3-capacitor-template",
  "version": "1.1.0",
  "description": "Phaser 3 project template for Phaser Editor 2D v3",
  "main": "index.js",
  "scripts": {
    "dev": "vite",
    "build": "tsc && vite build && phaser-asset-pack-hashing -j -r dist",
    "editor": "phasereditor2d-launcher -project . -port 1959",
    "editor-remote": "phasereditor2d-launcher -project . -disable-open-browser -public -port 1959",
    "build-android": "npm run build && cap sync && cd android && ./gradlew clean && ./gradlew assemble",
    "run-ios": "npm run build && cap sync && cap run ios",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Phaser Editor 2D <[email protected]> (https://phasereditor2d.com/)",
  "license": "MIT",
  "devDependencies": {
    "phaser-asset-pack-hashing": "^1.0.5",
    "@capacitor/cli": "^4.0.0",
    "typescript": "^4.5.4",
    "vite": "^2.7.2"
  },
  "dependencies": {
    "phasereditor2d-launcher": "^3.31.2",
    "@capacitor/android": "^4.0.0",
    "@capacitor/core": "^4.0.0",
    "@capacitor/ios": "^4.7.1",
    "phaser": "^3.55.2"
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant