citizen conn
citizen conn

Reputation: 15390

Import config file for use in javascript application with rollup

I am using rollup and I have a js project set up like this:

- public
- src
  + components
  main.js

manifest.json
rollup.config.js
package.json
etc...

Standard setup. In src/components/app/app.js I would like to have access to the values in manifest.json - they are part of the project configuration. How can I achieve this?

Edit: It would be super nice to be able to do for example in app.js:

import config from 'config';

const routes = config.routes;

Upvotes: 0

Views: 613

Answers (1)

Rich Harris
Rich Harris

Reputation: 29585

You need to use rollup-plugin-json.

Upvotes: 1

Related Questions