I'm trying to require an untyped module
config
// rollup.config.js
import typescript from 'rollup-plugin-typescript2';
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve'
export default {
input: 'src/index.ts',
output: {
format: 'es',
file: 'dist/index.js'
},
plugins: [
typescript(),
nodeResolve(),
commonjs()
]
}
input
// index.ts
var f = require('untypedModule')
f()
output
// dist/index.js
var f = require('untypedModule')
f()
As you can see 'typescript-plugin' somehow prevents 'commonJs' and 'nodeResolve' to produce proper output
If I remove 'typescript-plugin' from chain, the output is correct. commonJs plugin brings content of module and removes require call
Tried:
- change plugin order
- 'rollupCommonJSResolveHack' flag
I really want to 'require' untyped module, because it works in webpack
Please help.