Output JSON file to a separate assets folder #1279
tomektomczuk
started this conversation in
General
Replies: 1 comment
-
I can also see more threads like mine https://stackoverflow.com/questions/63993032/rollup-plugin-json-with-typescript-not-working |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Here is my vite.config.js file. I'm trying to output certain assets to a specific assets folder. Fonts to assets/fonts, Image to assets/images etc. Unfortunately for some reasons JSON files are not exported like everything else.
I also setup some https://stackblitz.com/edit/node-vs9rej?file=vite.config.js as an example.
import { defineConfig } from "vite";
import liveReload from 'vite-plugin-live-reload';
import vitePluginRequire from "vite-plugin-require";
import json from '@rollup/plugin-json';
const { resolve } = require('path');
const fs = require('fs');
export default defineConfig(({ command, mode }) =>{
return {
plugins: [
liveReload(__dirname + '/**/*.php'),
vitePluginRequire({
// @fileRegex RegExp
// optional:default file processing rules are as follows
// fileRegex:/(.jsx?|.tsx?|.vue)$/
}),
json({
}
})
when I run Vite build script I see
[plugin:json] Could not parse JSON file
[plugin:json] Could not parse JSON file (x2)
What is the problem?
Beta Was this translation helpful? Give feedback.
All reactions