I want to use the library ebnf
from NPM and create a bundle using rollup
. Since the ebnf
is installed to node_modules
I also use the rollup plugin rollup-plugin-node-resolve
.
The problem is that ebnf
contains the code require('..')
which - in my case - is resolved to dist
in my case. Thus it seems ..
is interpreted relative to the output file instead of being relative to the source file.
This is my rollup.config.js
(taken from my test repo jneuendorf/rollup-broken-resolve):
import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
export default {
input: 'src/index.js',
output: {
file: 'dist/bundle.js',
format: 'cjs'
},
// name: 'MyModule',
plugins: [
resolve(),
commonjs(),
]
}
Is this a problem in rollup-plugin-node-resolve
or am I doing something wrong?
require('../myutilsfile.js')
in the bundle which is causing the consumers of the bundled module to throw "cannot resolve '../myutilsfile.js'". Any luck on this? – Justness