Skip to content

Commit

Permalink
feat: bundle into moduleJS and split chunk (#34)
Browse files Browse the repository at this point in the history
* build by es modules

* lazy load page

* import order

* fix

* fix

---------

Co-authored-by: Atipat Pankong <atipat.p@lmwn.com>
  • Loading branch information
JAmoMES and Atipat Pankong committed Jun 23, 2024
1 parent 4841022 commit 8b3b910
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn pre-commit || npm run pre-commit
yarn lint-staged || npm run lint-staged
21 changes: 14 additions & 7 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
const globals = require('globals')
const js = require('@eslint/js')
import globals from 'globals'
import path from 'node:path'

const { FlatCompat } = require('@eslint/eslintrc')
import { fileURLToPath } from 'node:url'

const { includeIgnoreFile } = require('@eslint/compat')
const pluginVue = require('eslint-plugin-vue')
import js from '@eslint/js'

import { FlatCompat } from '@eslint/eslintrc'
import { includeIgnoreFile } from '@eslint/compat'

import pluginVue from 'eslint-plugin-vue'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

const path = require('node:path')
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})

const gitignorePath = path.resolve(__dirname, '.gitignore')

module.exports = [
export default [
includeIgnoreFile(gitignorePath),
...compat.extends('eslint:recommended', 'prettier'),
...pluginVue.configs['flat/recommended'],
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
"name": "ku-table",
"version": "1.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "NODE_OPTIONS=--openssl-legacy-provider vite",
"build": "NODE_OPTIONS=--openssl-legacy-provider vite build",
"serve": "NODE_OPTIONS=--openssl-legacy-provider vite preview",
"lint": "eslint --fix src",
"format": "prettier . --write",
"prepare": "husky install",
"pre-commit": "lint-staged"
"prepare": "husky install"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.36",
Expand Down
2 changes: 1 addition & 1 deletion postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
Expand Down
9 changes: 5 additions & 4 deletions src/router/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { createRouter, createWebHistory } from 'vue-router'
import Schedule from '@/pages/Schedule.vue'
import NotFound from '@/pages/NotFound.vue'
import Unit from '@/components/Unit.vue'
import Login from '@/pages/Login.vue'

const Schedule = () => import('@/pages/Schedule.vue')
const NotFound = () => import('@/pages/NotFound.vue')
const Unit = () => import('@/components/Unit.vue')
const Login = () => import('@/pages/Login.vue')

const routes = [
{
Expand Down
2 changes: 1 addition & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const gridConfig = () => {
}

/** @type {import('tailwindcss').Config} */
module.exports = {
export default {
content: ['./public/**/*.html', './src/**/*.vue'],
safelist: [
{
Expand Down

0 comments on commit 8b3b910

Please sign in to comment.