Enzyme install leads to wierd dependency issue #112
Comments
A good start would be to only apply this changes when testing the application. You can get this behaviour by doing the following: action: () => (rocObject) => {
const hook = rocObject.hook;
const rocBuilder = rocObject.previousValue;
// Only when running in test mode
if (hook === 'build-webpack' && rocObject.settings.build.mode === 'test') {
return () => () => {
rocBuilder.buildConfig.resolve.extensions = ['', '.js', '.json'];
rocBuilder.buildConfig.externals = {
jsdom: 'window',
cheerio: 'window',
'react/addons': true,
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': true,
};
return rocBuilder;
};
}
return null;
}, What you are trying to do is much the same as @tofagerl has been working on over in rocjs/roc-template-web-app-react#11. I will take a closer look at the issue now and get back to you with my findings. |
Fantastic. Solved it again! |
I have now looked closer at this and the reason for this happening is that The externals in question is https://github.com/rocjs/roc-package-webpack-node/blob/master/packages/roc-package-webpack-node-dev/src/builder/index.js#L29-L51 This types of issues/mistakes will soon be much more rare with the new configuration system in place which will land soon™. Great to hear that it works now! |
Hello again,
Thanks for the very swift responses so far! Excellent work!
I'm afraid I've found another edge-casey issue now disturbing my build:
My goal right now is to install create Roc.js -based repo that uses Enzyme to test components. Enzyme have some WebPack irregularities that makes it necessary to add a little extra to the roc.config.js file, as described in #111. I did that like this:
But there seems to be some side-effect of trying to add the
externals
that causesroc build
to fail. After adding theexternals
Roc started to ask for other dependencies (hjson, toml, jison, cson, properties), and when they were applied it tried to import the coffee-script compiler (shell) script as if it was a JS module (output from roc build --verbose added below)I have tried to isolate the problem in a public repo here: https://github.com/JacobOscarson/roc-cs-disturbed , where I have tried to make every commit do one step at a time to arrive at the problem. There is a shell script
reproduce.sh
in it's root that at least reproduces the problem on my machine.System information:
Output from roc build --verbose
The text was updated successfully, but these errors were encountered: