0

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;
5
  • import config from '../../../manifest.json'; should work according to app.js path you provided. Are you getting any error ? Commented Feb 19, 2018 at 13:56
  • @UsmanWali Yeah one of my plugins doesn't like it, complaining there's no available transformer for json Commented Feb 19, 2018 at 14:12
  • What node version do you have ? and can you share your package.json im just interested in your project dependencies btw. Commented Feb 19, 2018 at 14:24
  • 8.9.4 and I hardly have any dependencies Commented Feb 19, 2018 at 14:44
  • Update your node, I did had same issue long time ago and if I remember node update/or rollup update fixed it. If you dont want to update then var config = require('../../../manifest.json'); is another option :D Commented Feb 19, 2018 at 15:04

1 Answer 1

1

You need to use rollup-plugin-json.

Sign up to request clarification or add additional context in comments.

1 Comment

Straight from the source!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.