vue-gtag
vue-gtag copied to clipboard
Rollup failed to resolve import "vue-gtag" from "/workspace/src/main.ts"
Production *
npm ls vue-gtag: [email protected]
npm ls vue: [email protected]
Description *
In a development environment it works perfectly, but when building in DigitalOcean, the rollup had the following problem:
[2024-04-02 22:48:07] │ ---> Installing toolbox
[2024-04-02 22:48:07] │ ---> Getting Node version
[2024-04-02 22:48:07] │ ---> Resolving Node version
[2024-04-02 22:48:07] │ ---> Reusing Node v16.20.2
[2024-04-02 22:48:07] │ ---> Parsing package.json
[2024-04-02 22:48:07] │ ---> Installing [email protected]
[2024-04-02 22:48:08] │ ---> No file to start server
[2024-04-02 22:48:08] │ ---> either use 'docker run' to start container or add index.js or server.js
[2024-04-02 22:48:08] │ Project contains yarn.lock, using yarn
[2024-04-02 22:48:08] │ Warning: both yarn.lock and package-lock.json were found, using yarn.
[2024-04-02 22:48:08] │ Reusing cached node_modules from yarn.lock
[2024-04-02 22:48:20] │ Running custom build command: yarn build
[2024-04-02 22:48:24] │ yarn run v1.22.22
[2024-04-02 22:48:24] │ $ vite build
[2024-04-02 22:48:27] │ vite v4.4.9 building for production...
[2024-04-02 22:48:29] │ transforming...
[2024-04-02 22:48:33] │ DeprecationWarning: 'originalKeywordKind' has been deprecated since v5.0.0 and will no longer be usable after v5.2.0. Use 'identifierToKeywordKind(identifier)' instead.
[2024-04-02 22:48:36] │ ✓ 3 modules transformed.
[2024-04-02 22:48:36] │ ✓ built in 9.37s
[2024-04-02 22:48:36] │ [vite]: Rollup failed to resolve import "vue-gtag" from "/workspace/src/main.ts".
[2024-04-02 22:48:36] │ This is most likely unintended because it can break your application at runtime.
[2024-04-02 22:48:36] │ If you do want to externalize this module explicitly add it to
[2024-04-02 22:48:36] │ `build.rollupOptions.external`
[2024-04-02 22:48:36] │ error during build:
[2024-04-02 22:48:36] │ Error: [vite]: Rollup failed to resolve import "vue-gtag" from "/workspace/src/main.ts".
[2024-04-02 22:48:36] │ This is most likely unintended because it can break your application at runtime.
[2024-04-02 22:48:36] │ If you do want to externalize this module explicitly add it to
[2024-04-02 22:48:36] │ `build.rollupOptions.external`
[2024-04-02 22:48:36] │ at viteWarn (file:///workspace/node_modules/vite/dist/node/chunks/dep-df561101.js:48142:27)
[2024-04-02 22:48:36] │ at onRollupWarning (file:///workspace/node_modules/vite/dist/node/chunks/dep-df561101.js:48174:9)
[2024-04-02 22:48:36] │ at onwarn (file:///workspace/node_modules/vite/dist/node/chunks/dep-df561101.js:47902:13)
[2024-04-02 22:48:36] │ at file:///workspace/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:24194:13
[2024-04-02 22:48:36] │ at Object.logger [as onLog] (file:///workspace/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:25867:9)
[2024-04-02 22:48:36] │ at ModuleLoader.handleInvalidResolvedId (file:///workspace/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:24780:26)
[2024-04-02 22:48:36] │ at file:///workspace/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:24740:26
[2024-04-02 22:48:36] │ at processTicksAndRejections (node:internal/process/task_queues:96:5)
[2024-04-02 22:48:36] │ error Command failed with exit code 1.
[2024-04-02 22:48:36] │ info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[2024-04-02 22:48:36] │ building: exit status 1
[2024-04-02 22:48:36] │ ERROR: failed to build: exit status 1
[2024-04-02 22:48:36] │
[2024-04-02 22:48:36] │
[2024-04-02 22:48:36] │ For documentation on the buildpacks used to build your app, please see:
[2024-04-02 22:48:36] │
[2024-04-02 22:48:36] │ Node.js v0.3.6 https://do.co/apps-buildpack-node
[2024-04-02 22:48:36] │
[2024-04-02 22:48:37] │ ✘ build failed
Main.ts
import router from './router'
import store from './store'
import Shell from './shell.vue'
import VueGtag from 'vue-gtag'
const app = createApp(Shell)
const analyticsId = import.meta.env.VITE_ANALYTICS_ID
if (analyticsId) {
app.use(VueGtag, {
appName: 'app-jbfdigital',
pageTrackerScreenviewEnabled: true,
config: { id: analyticsId },
})
}
app.use(store).use(router).mount('#app')
Has anyone experienced this problem?
I'm not sure how to help you with this one. Did you manage to fix it?