@clikvn/showroom-visualizer 0.2.2-dev-13 → 0.2.2-dev-14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +19 -0
- package/README.md +31 -31
- package/base.json +21 -21
- package/dist/components/SkinLayer/DefaultLayout/index.d.ts +8 -0
- package/dist/components/SkinLayer/DefaultLayout/index.d.ts.map +1 -0
- package/dist/components/SkinLayer/PoiMovingPreview/index.d.ts.map +1 -1
- package/dist/context/CustomLayoutContext.d.ts +20 -0
- package/dist/context/CustomLayoutContext.d.ts.map +1 -0
- package/dist/context/SwizzleContext.d.ts +21 -0
- package/dist/context/SwizzleContext.d.ts.map +1 -0
- package/dist/fonts/icomoon.svg +633 -633
- package/dist/hooks/headless/index.d.ts +150 -0
- package/dist/hooks/headless/index.d.ts.map +1 -0
- package/dist/hooks/headless/useFloorplanControl.d.ts +18 -0
- package/dist/hooks/headless/useFloorplanControl.d.ts.map +1 -0
- package/dist/hooks/headless/usePOIInteraction.d.ts +23 -0
- package/dist/hooks/headless/usePOIInteraction.d.ts.map +1 -0
- package/dist/hooks/headless/useScenarioControl.d.ts +22 -0
- package/dist/hooks/headless/useScenarioControl.d.ts.map +1 -0
- package/dist/hooks/headless/useSceneNavigation.d.ts +26 -0
- package/dist/hooks/headless/useSceneNavigation.d.ts.map +1 -0
- package/dist/hooks/headless/useTourCore.d.ts +23 -0
- package/dist/hooks/headless/useTourCore.d.ts.map +1 -0
- package/dist/hooks/headless/useViewportControl.d.ts +22 -0
- package/dist/hooks/headless/useViewportControl.d.ts.map +1 -0
- package/dist/index.html +85 -10
- package/dist/index.js +1 -0
- package/dist/types/custom-layout.d.ts +63 -0
- package/dist/types/custom-layout.d.ts.map +1 -0
- package/dist/types/swizzle.d.ts +59 -0
- package/dist/types/swizzle.d.ts.map +1 -0
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +1 -1
- package/package.json +124 -124
- package/rollup.config.js +97 -97
- package/tailwind.config.cjs +151 -151
- package/dist/components/SkinLayer/Drawer/PoiHeader/index.d.ts +0 -16
- package/dist/components/SkinLayer/Drawer/PoiHeader/index.d.ts.map +0 -1
- package/dist/components/SkinLayer/Drawer/index.d.ts +0 -29
- package/dist/components/SkinLayer/Drawer/index.d.ts.map +0 -1
- package/dist/components/SkinLayer/PlayAll/index.d.ts +0 -8
- package/dist/components/SkinLayer/PlayAll/index.d.ts.map +0 -1
- package/dist/features/VirtualTourVisualizer/index.d.ts +0 -20
- package/dist/features/VirtualTourVisualizer/index.d.ts.map +0 -1
- package/dist/features/VirtualTourVisualizerUI/index.d.ts +0 -17
- package/dist/features/VirtualTourVisualizerUI/index.d.ts.map +0 -1
- /package/dist/features/ShowroomVisualizer/{cssStyles.d.ts → CssStyles.d.ts} +0 -0
- /package/dist/features/ShowroomVisualizer/{cssStyles.d.ts.map → CssStyles.d.ts.map} +0 -0
package/package.json
CHANGED
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@clikvn/showroom-visualizer",
|
|
3
|
-
"description": "Showroom Visualizer",
|
|
4
|
-
"version": "0.2.2-dev-
|
|
5
|
-
"author": "Clik JSC",
|
|
6
|
-
"license": "ISC",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"main": "dist/index.js",
|
|
9
|
-
"types": "dist/index.d.ts",
|
|
10
|
-
"scripts": {
|
|
11
|
-
"dev": "rollup --watch --config rollup.config.js",
|
|
12
|
-
"build": "rollup --config rollup.config.js",
|
|
13
|
-
"lint": "eslint src",
|
|
14
|
-
"lint:fix": "eslint --fix src",
|
|
15
|
-
"prettier": "prettier --write .",
|
|
16
|
-
"pub": "publish --access public",
|
|
17
|
-
"deploy": "yarn build && yarn publish --access public"
|
|
18
|
-
},
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"@clikvn/react-bottom-sheet": "^1.0.3",
|
|
21
|
-
"@clikvn/react-gallery-viewer": "^1.2.3-dev",
|
|
22
|
-
"@fortawesome/fontawesome-svg-core": "^6.6.0",
|
|
23
|
-
"@fortawesome/free-brands-svg-icons": "^6.6.0",
|
|
24
|
-
"@fortawesome/free-regular-svg-icons": "^6.6.0",
|
|
25
|
-
"@fortawesome/free-solid-svg-icons": "^6.6.0",
|
|
26
|
-
"@fortawesome/react-fontawesome": "^0.2.2",
|
|
27
|
-
"@radix-ui/react-slot": "^1.1.1",
|
|
28
|
-
"@ts-stack/markdown": "1.4.0",
|
|
29
|
-
"@types/moment": "^2.13.0",
|
|
30
|
-
"antd": "^5.27.2",
|
|
31
|
-
"axios": "^1.11.0",
|
|
32
|
-
"class-variance-authority": "^0.7.1",
|
|
33
|
-
"classnames": "^2.5.1",
|
|
34
|
-
"clsx": "^2.1.1",
|
|
35
|
-
"date-fns": "^4.1.0",
|
|
36
|
-
"device-detector-js": "^3.0.3",
|
|
37
|
-
"embla-carousel-react": "^8.6.0",
|
|
38
|
-
"framer-motion": "^12.23.12",
|
|
39
|
-
"howler": "^2.2.4",
|
|
40
|
-
"i18next": "^25.5.1",
|
|
41
|
-
"lodash": "^4.17.21",
|
|
42
|
-
"lucide-react": "^0.544.0",
|
|
43
|
-
"moment": "^2.30.1",
|
|
44
|
-
"node-fetch": "^3.3.2",
|
|
45
|
-
"qrcode.react": "^4.2.0",
|
|
46
|
-
"rc-progress": "^4.0.0",
|
|
47
|
-
"react": "^18.3.1",
|
|
48
|
-
"react-dom": "^18.3.1",
|
|
49
|
-
"react-i18next": "^15.7.3",
|
|
50
|
-
"react-intersection-image": "^2.1.2",
|
|
51
|
-
"react-markdown": "^9.0.3",
|
|
52
|
-
"react-planet": "^1.0.1-ie11",
|
|
53
|
-
"react-slick": "^0.31.0",
|
|
54
|
-
"react-truncate-markup": "^5.1.2",
|
|
55
|
-
"react-zoom-pan-pinch": "^3.7.0",
|
|
56
|
-
"remark-gfm": "^4.0.0",
|
|
57
|
-
"signals": "^1.0.0",
|
|
58
|
-
"sonner": "^2.0.7",
|
|
59
|
-
"swr": "^2.3.0",
|
|
60
|
-
"usehooks-ts": "^3.1.0",
|
|
61
|
-
"vtt.js": "^0.13.0",
|
|
62
|
-
"web-vitals": "^2.1.0"
|
|
63
|
-
},
|
|
64
|
-
"eslintConfig": {
|
|
65
|
-
"extends": [
|
|
66
|
-
"react-app",
|
|
67
|
-
"react-app/jest"
|
|
68
|
-
]
|
|
69
|
-
},
|
|
70
|
-
"browserslist": {
|
|
71
|
-
"production": [
|
|
72
|
-
">0.2%",
|
|
73
|
-
"not dead",
|
|
74
|
-
"not op_mini all"
|
|
75
|
-
],
|
|
76
|
-
"development": [
|
|
77
|
-
"last 1 chrome version",
|
|
78
|
-
"last 1 firefox version",
|
|
79
|
-
"last 1 safari version"
|
|
80
|
-
]
|
|
81
|
-
},
|
|
82
|
-
"devDependencies": {
|
|
83
|
-
"@rollup-extras/plugin-copy": "^1.11.1",
|
|
84
|
-
"@rollup/plugin-babel": "^6.0.4",
|
|
85
|
-
"@rollup/plugin-commonjs": "^28.0.1",
|
|
86
|
-
"@rollup/plugin-json": "^6.1.0",
|
|
87
|
-
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
88
|
-
"@rollup/plugin-typescript": "^12.1.1",
|
|
89
|
-
"@tailwindcss/typography": "^0.5.15",
|
|
90
|
-
"@testing-library/jest-dom": "^5.14.1",
|
|
91
|
-
"@testing-library/react": "^13.0.0",
|
|
92
|
-
"@testing-library/user-event": "^13.2.1",
|
|
93
|
-
"@types/howler": "^2.2.12",
|
|
94
|
-
"@types/jest": "^29.5.14",
|
|
95
|
-
"@types/lodash": "^4.17.20",
|
|
96
|
-
"@types/node": "^22.9.0",
|
|
97
|
-
"@types/node-fetch": "^2.6.13",
|
|
98
|
-
"@types/react": "^18.3.12",
|
|
99
|
-
"@types/react-dom": "^18.3.1",
|
|
100
|
-
"@types/signals": "^1.0.4",
|
|
101
|
-
"@typescript-eslint/eslint-plugin": "^8.20.0",
|
|
102
|
-
"@typescript-eslint/parser": "^8.20.0",
|
|
103
|
-
"autoprefixer": "^10.4.20",
|
|
104
|
-
"eslint": "^8.57.0",
|
|
105
|
-
"eslint-config-prettier": "^10.0.1",
|
|
106
|
-
"eslint-plugin-prettier": "^5.2.2",
|
|
107
|
-
"prettier": "^3.4.2",
|
|
108
|
-
"react-scripts": "5.0.1",
|
|
109
|
-
"rollup": "^4.26.0",
|
|
110
|
-
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
111
|
-
"rollup-plugin-postcss": "^4.0.2",
|
|
112
|
-
"rollup-plugin-replace": "^2.2.0",
|
|
113
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
114
|
-
"rollup-plugin-typescript-paths": "^1.5.0",
|
|
115
|
-
"rollup-plugin-uglify": "^6.0.4",
|
|
116
|
-
"tailwind-merge": "^2.6.0",
|
|
117
|
-
"tailwindcss": "^3.4.15",
|
|
118
|
-
"tailwindcss-animate": "^1.0.7",
|
|
119
|
-
"typescript": "^5.6.3"
|
|
120
|
-
},
|
|
121
|
-
"engines": {
|
|
122
|
-
"node": ">=18.18.0"
|
|
123
|
-
}
|
|
124
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@clikvn/showroom-visualizer",
|
|
3
|
+
"description": "Showroom Visualizer",
|
|
4
|
+
"version": "0.2.2-dev-14",
|
|
5
|
+
"author": "Clik JSC",
|
|
6
|
+
"license": "ISC",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "rollup --watch --config rollup.config.js",
|
|
12
|
+
"build": "rollup --config rollup.config.js",
|
|
13
|
+
"lint": "eslint src",
|
|
14
|
+
"lint:fix": "eslint --fix src",
|
|
15
|
+
"prettier": "prettier --write .",
|
|
16
|
+
"pub": "publish --access public",
|
|
17
|
+
"deploy": "yarn build && yarn publish --access public"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@clikvn/react-bottom-sheet": "^1.0.3",
|
|
21
|
+
"@clikvn/react-gallery-viewer": "^1.2.3-dev",
|
|
22
|
+
"@fortawesome/fontawesome-svg-core": "^6.6.0",
|
|
23
|
+
"@fortawesome/free-brands-svg-icons": "^6.6.0",
|
|
24
|
+
"@fortawesome/free-regular-svg-icons": "^6.6.0",
|
|
25
|
+
"@fortawesome/free-solid-svg-icons": "^6.6.0",
|
|
26
|
+
"@fortawesome/react-fontawesome": "^0.2.2",
|
|
27
|
+
"@radix-ui/react-slot": "^1.1.1",
|
|
28
|
+
"@ts-stack/markdown": "1.4.0",
|
|
29
|
+
"@types/moment": "^2.13.0",
|
|
30
|
+
"antd": "^5.27.2",
|
|
31
|
+
"axios": "^1.11.0",
|
|
32
|
+
"class-variance-authority": "^0.7.1",
|
|
33
|
+
"classnames": "^2.5.1",
|
|
34
|
+
"clsx": "^2.1.1",
|
|
35
|
+
"date-fns": "^4.1.0",
|
|
36
|
+
"device-detector-js": "^3.0.3",
|
|
37
|
+
"embla-carousel-react": "^8.6.0",
|
|
38
|
+
"framer-motion": "^12.23.12",
|
|
39
|
+
"howler": "^2.2.4",
|
|
40
|
+
"i18next": "^25.5.1",
|
|
41
|
+
"lodash": "^4.17.21",
|
|
42
|
+
"lucide-react": "^0.544.0",
|
|
43
|
+
"moment": "^2.30.1",
|
|
44
|
+
"node-fetch": "^3.3.2",
|
|
45
|
+
"qrcode.react": "^4.2.0",
|
|
46
|
+
"rc-progress": "^4.0.0",
|
|
47
|
+
"react": "^18.3.1",
|
|
48
|
+
"react-dom": "^18.3.1",
|
|
49
|
+
"react-i18next": "^15.7.3",
|
|
50
|
+
"react-intersection-image": "^2.1.2",
|
|
51
|
+
"react-markdown": "^9.0.3",
|
|
52
|
+
"react-planet": "^1.0.1-ie11",
|
|
53
|
+
"react-slick": "^0.31.0",
|
|
54
|
+
"react-truncate-markup": "^5.1.2",
|
|
55
|
+
"react-zoom-pan-pinch": "^3.7.0",
|
|
56
|
+
"remark-gfm": "^4.0.0",
|
|
57
|
+
"signals": "^1.0.0",
|
|
58
|
+
"sonner": "^2.0.7",
|
|
59
|
+
"swr": "^2.3.0",
|
|
60
|
+
"usehooks-ts": "^3.1.0",
|
|
61
|
+
"vtt.js": "^0.13.0",
|
|
62
|
+
"web-vitals": "^2.1.0"
|
|
63
|
+
},
|
|
64
|
+
"eslintConfig": {
|
|
65
|
+
"extends": [
|
|
66
|
+
"react-app",
|
|
67
|
+
"react-app/jest"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
"browserslist": {
|
|
71
|
+
"production": [
|
|
72
|
+
">0.2%",
|
|
73
|
+
"not dead",
|
|
74
|
+
"not op_mini all"
|
|
75
|
+
],
|
|
76
|
+
"development": [
|
|
77
|
+
"last 1 chrome version",
|
|
78
|
+
"last 1 firefox version",
|
|
79
|
+
"last 1 safari version"
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
"devDependencies": {
|
|
83
|
+
"@rollup-extras/plugin-copy": "^1.11.1",
|
|
84
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
85
|
+
"@rollup/plugin-commonjs": "^28.0.1",
|
|
86
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
87
|
+
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
88
|
+
"@rollup/plugin-typescript": "^12.1.1",
|
|
89
|
+
"@tailwindcss/typography": "^0.5.15",
|
|
90
|
+
"@testing-library/jest-dom": "^5.14.1",
|
|
91
|
+
"@testing-library/react": "^13.0.0",
|
|
92
|
+
"@testing-library/user-event": "^13.2.1",
|
|
93
|
+
"@types/howler": "^2.2.12",
|
|
94
|
+
"@types/jest": "^29.5.14",
|
|
95
|
+
"@types/lodash": "^4.17.20",
|
|
96
|
+
"@types/node": "^22.9.0",
|
|
97
|
+
"@types/node-fetch": "^2.6.13",
|
|
98
|
+
"@types/react": "^18.3.12",
|
|
99
|
+
"@types/react-dom": "^18.3.1",
|
|
100
|
+
"@types/signals": "^1.0.4",
|
|
101
|
+
"@typescript-eslint/eslint-plugin": "^8.20.0",
|
|
102
|
+
"@typescript-eslint/parser": "^8.20.0",
|
|
103
|
+
"autoprefixer": "^10.4.20",
|
|
104
|
+
"eslint": "^8.57.0",
|
|
105
|
+
"eslint-config-prettier": "^10.0.1",
|
|
106
|
+
"eslint-plugin-prettier": "^5.2.2",
|
|
107
|
+
"prettier": "^3.4.2",
|
|
108
|
+
"react-scripts": "5.0.1",
|
|
109
|
+
"rollup": "^4.26.0",
|
|
110
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
111
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
112
|
+
"rollup-plugin-replace": "^2.2.0",
|
|
113
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
114
|
+
"rollup-plugin-typescript-paths": "^1.5.0",
|
|
115
|
+
"rollup-plugin-uglify": "^6.0.4",
|
|
116
|
+
"tailwind-merge": "^2.6.0",
|
|
117
|
+
"tailwindcss": "^3.4.15",
|
|
118
|
+
"tailwindcss-animate": "^1.0.7",
|
|
119
|
+
"typescript": "^5.6.3"
|
|
120
|
+
},
|
|
121
|
+
"engines": {
|
|
122
|
+
"node": ">=18.18.0"
|
|
123
|
+
}
|
|
124
|
+
}
|
package/rollup.config.js
CHANGED
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
import resolve from '@rollup/plugin-node-resolve';
|
|
2
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
3
|
-
import typescript from '@rollup/plugin-typescript';
|
|
4
|
-
import { terser } from 'rollup-plugin-terser';
|
|
5
|
-
import postcss from 'rollup-plugin-postcss';
|
|
6
|
-
import { babel } from '@rollup/plugin-babel';
|
|
7
|
-
import autoprefixer from 'autoprefixer';
|
|
8
|
-
import { typescriptPaths } from 'rollup-plugin-typescript-paths';
|
|
9
|
-
import json from '@rollup/plugin-json';
|
|
10
|
-
import { uglify } from 'rollup-plugin-uglify';
|
|
11
|
-
import replace from 'rollup-plugin-replace';
|
|
12
|
-
import tailwindcss from 'tailwindcss';
|
|
13
|
-
import copy from '@rollup-extras/plugin-copy';
|
|
14
|
-
|
|
15
|
-
const extensions = ['.ts', '.tsx', '.js'];
|
|
16
|
-
const isDev =
|
|
17
|
-
process.env.NODE_ENV === 'development' || process.env.ROLLUP_WATCH === 'true';
|
|
18
|
-
|
|
19
|
-
const indexConfig = {
|
|
20
|
-
context: 'this',
|
|
21
|
-
onwarn(warning, warn) {
|
|
22
|
-
// Bỏ qua warning về "use client" directive
|
|
23
|
-
if (
|
|
24
|
-
warning.code === 'MODULE_LEVEL_DIRECTIVE' &&
|
|
25
|
-
warning.message.includes('"use client"')
|
|
26
|
-
) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
// Hiển thị các warning khác
|
|
30
|
-
warn(warning);
|
|
31
|
-
},
|
|
32
|
-
plugins: [
|
|
33
|
-
resolve({
|
|
34
|
-
extensions,
|
|
35
|
-
browser: true,
|
|
36
|
-
dedupe: ['useTranslation', 'i18n', 'I18nextProvider'],
|
|
37
|
-
}),
|
|
38
|
-
commonjs(),
|
|
39
|
-
// Skip uglify in dev mode - tốn thời gian
|
|
40
|
-
!isDev && uglify(),
|
|
41
|
-
json(),
|
|
42
|
-
// Skip babel in dev mode - giảm thời gian compile
|
|
43
|
-
!isDev &&
|
|
44
|
-
babel({
|
|
45
|
-
babelHelpers: 'bundled',
|
|
46
|
-
exclude: 'node_modules/**',
|
|
47
|
-
extensions,
|
|
48
|
-
}),
|
|
49
|
-
copy({
|
|
50
|
-
targets: [
|
|
51
|
-
{
|
|
52
|
-
src: [
|
|
53
|
-
'src/assets/fonts/icomoon.woff',
|
|
54
|
-
'src/assets/fonts/icomoon.ttf',
|
|
55
|
-
'src/assets/fonts/icomoon.svg',
|
|
56
|
-
'src/assets/fonts/icomoon.eot',
|
|
57
|
-
],
|
|
58
|
-
dest: 'fonts',
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
}),
|
|
62
|
-
replace({
|
|
63
|
-
'process.env.NODE_ENV': JSON.stringify(
|
|
64
|
-
isDev ? 'development' : 'production'
|
|
65
|
-
),
|
|
66
|
-
}),
|
|
67
|
-
postcss({
|
|
68
|
-
plugins: [autoprefixer(), tailwindcss()],
|
|
69
|
-
extract: false,
|
|
70
|
-
modules: false,
|
|
71
|
-
autoModules: false,
|
|
72
|
-
minimize: !isDev, // Skip minify CSS trong dev
|
|
73
|
-
inject: false,
|
|
74
|
-
}),
|
|
75
|
-
typescript({
|
|
76
|
-
sourceMap: isDev, // Source map chỉ trong dev
|
|
77
|
-
inlineSources: isDev,
|
|
78
|
-
}),
|
|
79
|
-
typescriptPaths({ preserveExtensions: true }),
|
|
80
|
-
// Skip terser trong dev - tốn rất nhiều thời gian
|
|
81
|
-
!isDev && terser({ output: { comments: false } }),
|
|
82
|
-
].filter(Boolean), // Remove false values
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const configs = [
|
|
86
|
-
{
|
|
87
|
-
input: './src/web.ts',
|
|
88
|
-
output: {
|
|
89
|
-
file: 'dist/web.js',
|
|
90
|
-
format: 'esm',
|
|
91
|
-
inlineDynamicImports: true,
|
|
92
|
-
},
|
|
93
|
-
...indexConfig,
|
|
94
|
-
},
|
|
95
|
-
];
|
|
96
|
-
|
|
97
|
-
export default configs;
|
|
1
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
2
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
3
|
+
import typescript from '@rollup/plugin-typescript';
|
|
4
|
+
import { terser } from 'rollup-plugin-terser';
|
|
5
|
+
import postcss from 'rollup-plugin-postcss';
|
|
6
|
+
import { babel } from '@rollup/plugin-babel';
|
|
7
|
+
import autoprefixer from 'autoprefixer';
|
|
8
|
+
import { typescriptPaths } from 'rollup-plugin-typescript-paths';
|
|
9
|
+
import json from '@rollup/plugin-json';
|
|
10
|
+
import { uglify } from 'rollup-plugin-uglify';
|
|
11
|
+
import replace from 'rollup-plugin-replace';
|
|
12
|
+
import tailwindcss from 'tailwindcss';
|
|
13
|
+
import copy from '@rollup-extras/plugin-copy';
|
|
14
|
+
|
|
15
|
+
const extensions = ['.ts', '.tsx', '.js'];
|
|
16
|
+
const isDev =
|
|
17
|
+
process.env.NODE_ENV === 'development' || process.env.ROLLUP_WATCH === 'true';
|
|
18
|
+
|
|
19
|
+
const indexConfig = {
|
|
20
|
+
context: 'this',
|
|
21
|
+
onwarn(warning, warn) {
|
|
22
|
+
// Bỏ qua warning về "use client" directive
|
|
23
|
+
if (
|
|
24
|
+
warning.code === 'MODULE_LEVEL_DIRECTIVE' &&
|
|
25
|
+
warning.message.includes('"use client"')
|
|
26
|
+
) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
// Hiển thị các warning khác
|
|
30
|
+
warn(warning);
|
|
31
|
+
},
|
|
32
|
+
plugins: [
|
|
33
|
+
resolve({
|
|
34
|
+
extensions,
|
|
35
|
+
browser: true,
|
|
36
|
+
dedupe: ['useTranslation', 'i18n', 'I18nextProvider'],
|
|
37
|
+
}),
|
|
38
|
+
commonjs(),
|
|
39
|
+
// Skip uglify in dev mode - tốn thời gian
|
|
40
|
+
!isDev && uglify(),
|
|
41
|
+
json(),
|
|
42
|
+
// Skip babel in dev mode - giảm thời gian compile
|
|
43
|
+
!isDev &&
|
|
44
|
+
babel({
|
|
45
|
+
babelHelpers: 'bundled',
|
|
46
|
+
exclude: 'node_modules/**',
|
|
47
|
+
extensions,
|
|
48
|
+
}),
|
|
49
|
+
copy({
|
|
50
|
+
targets: [
|
|
51
|
+
{
|
|
52
|
+
src: [
|
|
53
|
+
'src/assets/fonts/icomoon.woff',
|
|
54
|
+
'src/assets/fonts/icomoon.ttf',
|
|
55
|
+
'src/assets/fonts/icomoon.svg',
|
|
56
|
+
'src/assets/fonts/icomoon.eot',
|
|
57
|
+
],
|
|
58
|
+
dest: 'fonts',
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
}),
|
|
62
|
+
replace({
|
|
63
|
+
'process.env.NODE_ENV': JSON.stringify(
|
|
64
|
+
isDev ? 'development' : 'production'
|
|
65
|
+
),
|
|
66
|
+
}),
|
|
67
|
+
postcss({
|
|
68
|
+
plugins: [autoprefixer(), tailwindcss()],
|
|
69
|
+
extract: false,
|
|
70
|
+
modules: false,
|
|
71
|
+
autoModules: false,
|
|
72
|
+
minimize: !isDev, // Skip minify CSS trong dev
|
|
73
|
+
inject: false,
|
|
74
|
+
}),
|
|
75
|
+
typescript({
|
|
76
|
+
sourceMap: isDev, // Source map chỉ trong dev
|
|
77
|
+
inlineSources: isDev,
|
|
78
|
+
}),
|
|
79
|
+
typescriptPaths({ preserveExtensions: true }),
|
|
80
|
+
// Skip terser trong dev - tốn rất nhiều thời gian
|
|
81
|
+
!isDev && terser({ output: { comments: false } }),
|
|
82
|
+
].filter(Boolean), // Remove false values
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const configs = [
|
|
86
|
+
{
|
|
87
|
+
input: './src/web.ts',
|
|
88
|
+
output: {
|
|
89
|
+
file: 'dist/web.js',
|
|
90
|
+
format: 'esm',
|
|
91
|
+
inlineDynamicImports: true,
|
|
92
|
+
},
|
|
93
|
+
...indexConfig,
|
|
94
|
+
},
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
export default configs;
|