'Unresolved dependencies rollup

I'm doing import file from 'file.json in a Vue component, but have a challenge when I run npm run build to bundle it with Rollup.

It throws this error below and the file doesn't get bundled.

rollup error

This is what I have in `rollup.config.js

import vue from 'rollup-plugin-vue'; 
import buble from 'rollup-plugin-buble';
import resolve from 'rollup-plugin-node-resolve'
import json from 'rollup-plugin-json'

export default {
input: 'src/plugin.js',
output: {
    name: 'NaijaStatesLgas',
    exports: 'named',
},
plugins: [
    json(),
    resolve({
        jsnext: true,
        main: true,
        browser: true,
        extensions: [".js", ".json"],
        preferBuiltins: false,
    }),
    vue({
        compileTemplate: true, 
function
        }),
        buble(),
    ],
};

Would appreciate if someone could point me in the right direction.



Solution 1:[1]

I resolved it by changing import file from 'file.json' to import file from './file.json' That allows it to see the file as a local module.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1