Couldnt compile demo with sinon
sameer-kumar-jain opened this issue · 1 comments
I am very new to all this webpack stuff. I've downloaded the code and it works fine on my server. I then try to recompile main.js with webpack and stuck on the following warnings.
WARNING in .//sinon/lib/sinon/util/fake_server.js/sinon/lib/sinon/util/fake_server.js 243:25-32
Critical dependencies:
243:25-32 require function is used in a way in which dependencies cannot be statically extracted
@ ./
WARNING in .//sinon/lib/sinon/util/core.js/sinon/lib/sinon/util/core.js 392:25-32
Critical dependencies:
392:25-32 require function is used in a way in which dependencies cannot be statically extracted
@ ./
WARNING in .//sinon/lib/sinon/util/fake_server_with_clock.js/sinon/lib/sinon/util/fake_server_with_clock.js 97:25-32
Critical dependencies:
97:25-32 require function is used in a way in which dependencies cannot be statically extracted
@ ./
WARNING in .//sinon/lib/sinon/util/fake_timers.js/sinon/lib/sinon/util/fake_timers.js 69:25-32
Critical dependencies:
69:25-32 require function is used in a way in which dependencies cannot be statically extracted
@ ./
WARNING in .//sinon/lib/sinon/util/fake_xml_http_request.js/sinon/lib/sinon/util/fake_xml_http_request.js 706:25-32
Critical dependencies:
706:25-32 require function is used in a way in which dependencies cannot be statically extracted
@ ./
WARNING in .//sinon/lib/sinon/util/fake_xdomain_request.js/sinon/lib/sinon/util/fake_xdomain_request.js 235:25-32
Critical dependencies:
235:25-32 require function is used in a way in which dependencies cannot be statically extracted
@ ./
WARNING in .//sinon/lib/sinon/util/event.js/sinon/lib/sinon/util/event.js 107:25-32
Critical dependencies:
107:25-32 require function is used in a way in which dependencies cannot be statically extracted
@ ./
Child extract-text-webpack-plugin:
+ 3 hidden modules
And if I run the admin module I get following error in console
Uncaught TypeError: Cannot read property 'call' of undefined
webpack_require @ main.js:20
loadDependencies @ main.js:384
(anonymous function) @ main.js:393
(anonymous function) @ main.js:399
(anonymous function) @ main.js:401
webpack_require @ main.js:20
(anonymous function) @ main.js:125
webpack_require @ main.js:20
(anonymous function) @ main.js:58
webpack_require @ main.js:20
(anonymous function) @ main.js:47
webpack_require @ main.js:20
(anonymous function) @ main.js:40
(anonymous function) @ main.js:43
angular.js:68
Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to:
Error: [$injector:nomod] Module 'myApp' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
I have following modules install through npm
admin-config
babel
babel-core
babel-loader
babel-preset-es2015
css-loader
extract-text-webpack-plugin
fakerest
html-loader
moment
ng-admin
node-sass
sass-loader
sinon
webpack
I am using latest gitbash to run the webpack command. And here is my webpack.config.js file. Since it didnt work with babel I had to us presets Es2015, somebody suggested that and it hide many errors :)
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: ["./js/main.js", "./css/main.scss"],
output: {
path: __dirname + "/build",
filename: "main.js",
publicPath: "/build"
},
module: {
loaders: [
{ test: /.css$/, loader: "style!css" },
{ test: /.jsx?$/, exclude: /(node_modules|bower_components)/, loader: 'babel', query: {
presets: ['es2015']
} },
{ test: /node_modules[\/]admin-config[\/].*.jsx?$/, loader: 'babel', query: {
presets: ['es2015']
} },
{ test: /.html$/, loader: 'html' },
{ test: /.css$/, loader: ExtractTextPlugin.extract('css') },
{ test: /.scss$/, loader: ExtractTextPlugin.extract('css!sass') }
]
},cache:false,
plugins: [
new ExtractTextPlugin('[name].css', {
allChunks: true
})
]
};
Please ask for more info if required. I didnt edit any files except the webpack.config.js
Thanks for your hard work, I appreciate that. Keep it up.
May be its my fault, I cleared npm-cache then npm install did the job. Sorry to torture.
keep it positive
Thanks