When I try to use import file from 'file.json'
in a Vue
component and run npm run build
to bundle it with Rollup, I encounter an issue.
An error is thrown during the process, preventing the file from being bundled as expected.
https://i.sstatic.net/LWThA.png
This is the content of my `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(),
],
};
I would appreciate any guidance on how to resolve this issue. Thank you!