Closed sk- closed 8 years ago
Hi, @sk- .
It's legendary problem =). Check out this issue in webpack repo https://github.com/webpack/webpack/issues/304
This problem is related with incorrect sinon exports module interface, you should load sinon "manually" to solve it.
I'm not sure that is the problem. I'm using version 2.0 of sinon from github and I did not have any troubles when requiring the previous version of sinon chrome with webpack. On Nov 14, 2015 5:43 AM, "Aleksey Tsvetkov" notifications@github.com wrote:
Hi.
It's legendary problem =). Check out this issue in webpack repo webpack/webpack#304 https://github.com/webpack/webpack/issues/304
This problem is related with incorrect sinon exports module interface, you should load sinon "manually" to solve it.
— Reply to this email directly or view it on GitHub https://github.com/acvetkov/sinon-chrome/issues/11#issuecomment-156670914 .
@sk-, Because we have bundled sinon-chrome by webpack since 1.0 version.
In version < 1.0, we have not build with resolving dependencies, only js files concatination.
I think, I can fix our webpack config to solve this problem.
But you should know, you can do it in your project webpack config. Just fix loader for sinon module.
@sk- Can you change your webpack config? Add rules
var path = require('path');
// ...
resolve: {
alias: {
sinon: path.resolve(__dirname, 'node_modules/sinon/pkg/sinon.js') // require dist version instead
}
},
module: {
noParse: [
/node_modules\/sinon/ // ignore sinon module
]
}
You should install sinon
before,
Look at my webpack.config
@acvetkov Your config almost worked for me - I had to make 2 modifications:
sinon that is inside
node_modules/sinon/libinstead of
node_modules/sinon/pkg`$
to the noParse
rule. Otherwise it would also eagerly cover the sinon-chrome
package itself!var path = require('path');
// ...
resolve: {
alias: {
sinon: path.resolve(__dirname, 'node_modules/sinon/lib/sinon.js') // require dist version instead
}
},
module: {
noParse: [
/node_modules\/sinon$/ // ignore sinon module
]
}
When I try to require the new version
1.0.0
with webpack I get the following error.