-
Notifications
You must be signed in to change notification settings - Fork 126
Uncaught ReferenceError: require is not defined #134
Comments
@aedart Did you manage to resolve this? I think it has something to do with rollup-plugin-commonjs not resolving nested dependencies.. |
@Samlilli Sadly my solution is not that good.... I ended up transpiling the mqtt package for itself, using webpack and then I manually added a Also, not sure how familiar you are with karm, but you will find all of the rollup configuration inside the |
Please see https://gist.github.com/Rich-Harris/88c5fc2ac6dc941b22e7996af05d70ff – there's too much noise in the information given to start investigating. Thanks |
I'm getting this error message with when I try to import a module called let commonjs = require('rollup-plugin-commonjs');
let nodeResolve = require('rollup-plugin-node-resolve');
export default {
entry: 'main.js',
dest: 'bundle.js',
format: 'iife',
plugins: [
nodeResolve({jsnext: true}),
commonjs({
include: ['node_modules/rxjs/**', 'node_modules/ag-grid-ng2/**'],
namedExports: {
'node_modules/ag-grid-ng2/main.js': ['AgGridModule']
}
})
]
}; and the following import {AgGridModule} from 'ag-grid-ng2/main';
console.log('imported ag grid', AgGridModule); Here is a minimal app that reproduces the issue it's already build so to run it run To rebuild the app run npm install
rollup -c rollup.config.js I also created an issue on the ag-grid-ng2 repo as I am not sure where the issue lies https://github.com/ceolter/ag-grid-ng2/issues/112#issuecomment-270708588 |
I have a repro. See: calvinmetcalf/rollup-plugin-node-builtins#24 |
@unional 's issue seems to have to do with a prestep which turns typescript into commonjs |
@unional you probably want to use https://github.com/rollup/rollup-plugin-typescript |
Typescript to commonjs is done directly by the I can't use |
rollup is designed for use with es6 modules, if you aren't using es6 modules you probably shouldn't use rollup |
I'm going to close this as it seems to have gone off on a few tangents, and the repros mentioned don't follow these guidelines. Feel free to open a new issue with a minimal reproduction. |
For an application that I'm trying to make, I'm importing the
mqtt
package, yet it keeps failing, due torequire
not being defined?!Since that package exports multiple components, I have to import it as such, which should work
I know that this has reference to #77 and #108, but not sure what I'm doing wrong....!?
Additional info:
package.json
karma.config.js
tests/MainTest.js
The text was updated successfully, but these errors were encountered: