6

I am using Vuetify 1.5.18 and have the following code...

import Vuetify from 'vuetify'
...
// rollup config
import VuePlugin from 'rollup-plugin-vue';
import css from 'rollup-plugin-css-only';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import pkg from './package.json';

// const external = Object.keys(pkg.dependencies);
const plugins = [
    resolve({
      module: true,
      main: true
    }),
    commonjs(),
    VuePlugin(),
    css()
];
module.exports = {
  plugins,
  input: 'src/index.js',
  output: {
    file: 'dist/index.js',
    format: 'esm'
  }
};

But when I run rollup I get the following in my output...

import vue from 'vue';

And when I try to run I get the following error...

Failed to resolve module specifier "vue". Relative references must start with either "/", "./", or "../".`

I load Vue not in the UI project but in my server like this...

// Footer.pug
script(type="module")
          | import Vue from '/vue/vue.esm.browser.js'
          | const global = window || global;
          | global.Vue = Vue;

So that line shouldn't be there. If I remove Vuetify it goes away. Also if I point to the version I have hosted through the Koa app like this...

import * as Vuetify from '/vuetify/vuetify.js';

Everything seems to work as well. I can also go in and manually remove the import Vuetify from 'vuetify' and add this line to the template on the server...

| const global = window || global;
| global.vue = global.Vue;

Is there a way I can tell rollup to ignore any "vue" imports?

vsync
  • 118,978
  • 58
  • 307
  • 400
Jackie
  • 21,969
  • 32
  • 147
  • 289
  • 5
    Unfortunate that no one has even commented for all this time. The plugin `rollup-plugin-ignore` ignoring the package in question fixed the issue for me – Post Self Mar 09 '21 at 23:46
  • Bit late, but I think you were looking for this https://stackoverflow.com/a/71552903/812919 – olfek Feb 06 '23 at 19:38

0 Answers0