straker/rollup-plugin-kontra

Error: Cannot find module due to incorrect main path

Closed this issue · 2 comments

I'm getting: Error: Cannot find module '.../node_modules/rollup-plugin-kontra/index.js'. Please verify that the package.json has a valid "main" entry

When I install rollup-plugin-kontra via this repo (as it's not on npm yet? 😢), then try to include it like this:

const kontra = require('rollup-plugin-kontra');

And use it with rollup like this:

const watcher = rollup.watch({
    input: config.input,
    output: [ config.output ],
    watch: {
        include: 'src/**'
    },
    plugins: [
        resolve(),
        kontra({
            gameObject: {
                velocity: true
            },
            debug: DEBUG
        })
    ]
});

I believe it's fixed by just changing line 5 of rollup-plugin-kontra's package.json from "main": "index.js", to "main": "src/index.js",?

I could do a PR for this, I just wanted to check first that it's not being caused by something odd I'm doing myself, and/or if it'd make more sense to move index.js up out of src/ instead 🙂

Ops, I forgot I hadn't published this yet (it's been waiting this whole time for v7 to be ready). You are correct the main file path is off.