Closed ForrestHong closed 1 year ago
Hi there @ForrestHong,
Can you share a repo of this where I can take a look ?
I just created a fresh Vite project this morning and Font Awesome Icons are showing up nicely. You can check it out here: https://github.com/jasonlundien/fa-vue-vite-testing
Hello jasonlundien
Thanks for the comments, compared with your Vite Project above, I found I had a define for "global" in vite.config.js. after I remove it, the npm build passed.
--- a/Vue/vue-demo/vite.config.js
+++ b/Vue/vue-demo/vite.config.js
@@ -9,9 +9,6 @@ export default defineConfig({
plugins: [
vue(),
],
- define: {
- global: {},
- },
resolve: {
alias: {
mqtt: 'mqtt/dist/mqtt.js',
Describe the bug When I build the my vue project, I got following error
`
vite v4.3.9 building for production... ✓ 3 modules transformed. ✓ built in 162ms [commonjs--resolver] Unexpected token (254:7) in /path/to/my/project/my-vue3-project/node_modules/@fortawesome/vue-fontawesome/index.es.js file: /path/to/my/project/my-vue3-project/node_modules/@fortawesome/vue-fontawesome/index.es.js:254:7 252: module.exports = humps; 253: } else { 254: global.humps = humps; ^ 255: } error during build: SyntaxError: Unexpected token (254:7) in /path/to/my/project/my-vue3-project/node_modules/@fortawesome/vue-fontawesome/index.es.js at Object.pp$4.raise (file:///path/to/my/project/my-vue3-project/node_modules/rollup/dist/es/shared/node-entry.js:21266:13) at Object.pp$9.unexpected (file:///path/to/my/project/my-vue3-project/node_modules/rollup/dist/es/shared/node-entry.js:18567:8) at Object.pp$5.parseExprAtom (file:///path/to/my/project/my-vue3-project/node_modules/rollup/dist/es/shared/node-entry.js:20650:10) at Object.pp$5.parseExprSubscripts (file:///path/to/my/project/my-vue3-project/node_modules/rollup/dist/es/shared/node-entry.js:20442:19) at Object.pp$5.parseMaybeUnary (file:///path/to/my/project/my-vue3-project/node_modules/rollup/dist/es/shared/node-entry.js:20408:17) at Object.pp$5.parseExprOps (file:///path/to/my/project/my-vue3-project/node_modules/rollup/dist/es/shared/node-entry.js:20335:19) at Object.pp$5.parseMaybeConditional (file:///path/to/my/project/my-vue3-project/node_modules/rollup/dist/es/shared/node-entry.js:20318:19) at Object.pp$5.parseMaybeAssign (file:///path/to/my/project/my-vue3-project/node_modules/rollup/dist/es/shared/node-entry.js:20285:19) at Object.pp$5.parseExpression (file:///path/to/my/project/my-vue3-project/node_modules/rollup/dist/es/shared/node-entry.js:20248:19) at Object.pp$8.parseStatement (file:///path/to/my/project/my-vue3-project/node_modules/rollup/dist/es/shared/node-entry.js:18757:45) `
Reproducible test case Here are the packets i installed.
my-project@0.0.0 /path/to/my/porject/my-projec ├── @fortawesome/fontawesome-svg-core@6.4.0 ├── @fortawesome/free-brands-svg-icons@6.4.0 ├── @fortawesome/free-regular-svg-icons@6.4.0 ├── @fortawesome/free-solid-svg-icons@6.4.0 ├── @fortawesome/vue-fontawesome@3.0.3 ├── @popperjs/core@2.11.8 ├── @vitejs/plugin-vue@4.2.3 ├── @vue/compat@3.3.4 ├── @vue/compiler-sfc@3.3.4 ├── @vuepic/vue-datepicker@5.3.0 ├── bootstrap-icons@1.10.5 ├── bootstrap@5.3.0 ├── chart.js@4.3.0 ├── chartjs-plugin-zoom@2.0.1 ├── mqtt@4.3.7 ├── vite@4.3.9 ├── vue-chartjs@5.2.0 ├── vue-loading-overlay@6.0.3 └── vue@3.3.4