Closed sachabarber closed 7 years ago
@sachabarber you were using inversify 1.x? and now you are using inversify 2.x?
No this is a NEW project, straight into inversify 2.x, my actual git repo is here if you wanted to try the issue yourself : https://github.com/sachabarber/MadCapIdea
that is a running webpack/react/typescript app.
You would need to install inversify 2 into that, and hack the tsconfig.json file
Then after you have done that you can simply open the FrontEndWebSite folder in a command line and run webpack on it (oh after getting NPM to download all the required depedencies that is)
I would very grateful if you could find time to download that, and see what you make of it
@remojansen even if you can see anything obviously wrong with my setup that would be helpful, i'm really struggling
Hi @sachabarber sorry but I'm at work at the moment. I will try to help you as soon as I have some free time at home. I will try tonight but I can't promise I will have time.
@remojansen I would be like over the moon if you came back to me anytime within a week to be honest. I am just completely stuck.
I tried my best, I was an MVP for 9 years in C#, so hopefully I gave it my best try. I sadly lost MVP this year due to me spending more time on other stuff. You still are one right? Good for you.
Honestly any help you can give me, even if it comes in 5 days would be VERY VERY happily (even gleefully) received
I also wrote a container in C# (here if you want a gander : https://www.codeproject.com/Articles/552514/BarbarianIOC-A-simple-IOC-Container was fun)
I'm a Microsoft MVP right now but only for 1 year so far :smile:
I cloned your repo and tried to run webpack but I got a lot of erros:
$ webpack
Webpack is watching the files…
[at-loader] Using typescript@2.3.2 from typescript and "tsconfig.json" from /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/tsconfig.json.
[at-loader] Checking started in a separate process...
[at-loader] Ok, 0.142 sec.
Hash: 3f9d9fcf98de5073db24
Version: webpack 2.5.1
Time: 6533ms
Asset Size Chunks Chunk Names
vendor.bundle.3f9d9fcf98de5073db24.js 2.34 MB 0 [emitted] [big] vendor
index.bundle.3f9d9fcf98de5073db24.js 4.04 kB 1 [emitted] index
indexCss.bundle.3f9d9fcf98de5073db24.js 194 bytes 2 [emitted] indexCss
indexCss.bundle.3f9d9fcf98de5073db24.css 187 bytes 2 [emitted] indexCss
vendor.bundle.3f9d9fcf98de5073db24.js.map 2.51 MB 0 [emitted] vendor
index.bundle.3f9d9fcf98de5073db24.js.map 3.65 kB 1 [emitted] index
indexCss.bundle.3f9d9fcf98de5073db24.js.map 328 bytes 2 [emitted] indexCss
indexCss.bundle.3f9d9fcf98de5073db24.css.map 117 bytes 2 [emitted] indexCss
index.html 524 bytes [emitted]
[0] ./~/react/react.js 56 bytes {0} [built]
[11] ./~/fbjs/lib/warning.js 2.1 kB {0} [built]
[14] ./~/object-assign/index.js 2.11 kB {0} [built]
[15] ./~/react-dom/lib/ReactDOMComponentTree.js 6.27 kB {0} [built]
[19] ./~/react-dom/index.js 59 bytes {0} [built]
[50] ./~/react/lib/React.js 3.32 kB {0} [built]
[202] ./src/index.tsx 976 bytes {1} [built]
[203] ./~/bootstrap/dist/css/bootstrap.css 3.73 kB {0} [built] [failed] [1 error]
[204] ./scss/index.scss 41 bytes {2} [built]
[283] ./~/jquery/dist/jquery.js 268 kB {0} [built]
[284] ./~/lodash/lodash.js 540 kB {0} [built]
[346] ./~/react-bootstrap/es/index.js 4.85 kB {0} [built]
[364] ./~/react-dom/lib/ReactDOM.js 5.14 kB {0} [built]
[396] ./~/react-dom/lib/ReactVersion.js 350 bytes {0} [built]
[413] ./~/react-dom/lib/findDOMNode.js 2.46 kB {0} [built]
+ 430 hidden modules
ERROR in ./~/bootstrap/dist/css/bootstrap.css
Module build failed: ModuleNotFoundError: Module not found: Error: Can't resolve 'file-loader' in '/home/rjansen/CODE/MadCapIdea/FrontEndWebSite'
at factoryCallback (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/webpack/lib/Compilation.js:264:39)
at factory (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/webpack/lib/NormalModuleFactory.js:247:20)
at resolver (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/webpack/lib/NormalModuleFactory.js:65:21)
at asyncLib.parallel (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/webpack/lib/NormalModuleFactory.js:202:22)
at /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/async/dist/async.js:3838:9
at /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/async/dist/async.js:421:16
at iteratorCallback (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/async/dist/async.js:996:13)
at /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/async/dist/async.js:906:16
at /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/async/dist/async.js:3835:13
at /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/async/dist/async.js:1074:9
at /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/async/dist/async.js:421:16
at iteratorCallback (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/async/dist/async.js:996:13)
at /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/async/dist/async.js:906:16
at /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/async/dist/async.js:1071:13
at resolver.resolve (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/webpack/lib/NormalModuleFactory.js:273:20)
at onResolved (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/Resolver.js:70:11)
at loggingCallbackWrapper (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
at afterInnerCallback (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/Resolver.js:138:10)
at loggingCallbackWrapper (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
at Resolver.applyPluginsAsyncSeriesBailResult1 (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/tapable/lib/Tapable.js:181:46)
at innerCallback (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/Resolver.js:125:19)
at loggingCallbackWrapper (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
at /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/tapable/lib/Tapable.js:283:15
at /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:38:4
at loggingCallbackWrapper (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
at afterInnerCallback (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/Resolver.js:138:10)
at loggingCallbackWrapper (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
at Resolver.applyPluginsAsyncSeriesBailResult1 (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/tapable/lib/Tapable.js:181:46)
at innerCallback (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/Resolver.js:125:19)
at loggingCallbackWrapper (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
@ ./src/components/Hello.tsx 18:0-43
@ ./src/index.tsx
ERROR in ./~/bootstrap/dist/css/bootstrap.css
Module build failed: ModuleNotFoundError: Module not found: Error: Can't resolve 'file-loader' in '/home/rjansen/CODE/MadCapIdea/FrontEndWebSite'
at factoryCallback (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/webpack/lib/Compilation.js:264:39)
at factory (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/webpack/lib/NormalModuleFactory.js:247:20)
at resolver (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/webpack/lib/NormalModuleFactory.js:65:21)
at asyncLib.parallel (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/webpack/lib/NormalModuleFactory.js:202:22)
at /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/async/dist/async.js:3838:9
at /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/async/dist/async.js:421:16
at iteratorCallback (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/async/dist/async.js:996:13)
at /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/async/dist/async.js:906:16
at /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/async/dist/async.js:3835:13
at /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/async/dist/async.js:1074:9
at /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/async/dist/async.js:421:16
at iteratorCallback (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/async/dist/async.js:996:13)
at /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/async/dist/async.js:906:16
at /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/async/dist/async.js:1071:13
at resolver.resolve (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/webpack/lib/NormalModuleFactory.js:273:20)
at onResolved (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/Resolver.js:70:11)
at loggingCallbackWrapper (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
at afterInnerCallback (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/Resolver.js:138:10)
at loggingCallbackWrapper (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
at Resolver.applyPluginsAsyncSeriesBailResult1 (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/tapable/lib/Tapable.js:181:46)
at innerCallback (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/Resolver.js:125:19)
at loggingCallbackWrapper (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
at /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/tapable/lib/Tapable.js:283:15
at /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:38:4
at loggingCallbackWrapper (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
at afterInnerCallback (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/Resolver.js:138:10)
at loggingCallbackWrapper (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
at Resolver.applyPluginsAsyncSeriesBailResult1 (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/tapable/lib/Tapable.js:181:46)
at innerCallback (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/Resolver.js:125:19)
at loggingCallbackWrapper (/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
ERROR in /home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/extract-text-webpack-plugin/loader.js??ref--1-0!/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/css-loader/index.js?importLoaders=1!/home/rjansen/CODE/MadCapIdea/FrontEndWebSite/node_modules/bootstrap/dist/css/bootstrap.css doesn't export content
Child extract-text-webpack-plugin:
[0] ./~/css-loader/lib/css-base.js 2.26 kB {0} [built]
[1] ./~/css-loader!./~/sass-loader/lib/loader.js!./scss/index.scss 290 bytes {0} [built]
Child html-webpack-plugin for "index.html":
[0] ./~/lodash/lodash.js 540 kB {0} [built]
[1] ./~/html-webpack-plugin/lib/loader.js!./template.html 565 bytes {0} [built]
[2] (webpack)/buildin/global.js 509 bytes {0} [built]
[3] (webpack)/buildin/module.js 517 bytes {0} [built]
Child extract-text-webpack-plugin:
[0] ./~/css-loader/lib/css-base.js 2.26 kB {0} [built]
[1] ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css 154 kB {0} [built]
ERROR in ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css
Module not found: Error: Can't resolve 'file-loader' in '/home/rjansen/CODE/MadCapIdea/FrontEndWebSite'
@ ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css 6:4445-4497 6:4520-4572
ERROR in ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css
Module not found: Error: Can't resolve 'url-loader' in '/home/rjansen/CODE/MadCapIdea/FrontEndWebSite'
@ ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css 6:4622-4676
ERROR in ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css
Module not found: Error: Can't resolve 'url-loader' in '/home/rjansen/CODE/MadCapIdea/FrontEndWebSite'
@ ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css 6:4707-4760
ERROR in ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css
Module not found: Error: Can't resolve 'url-loader' in '/home/rjansen/CODE/MadCapIdea/FrontEndWebSite'
@ ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css 6:4790-4842
ERROR in ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css
Module not found: Error: Can't resolve 'url-loader' in '/home/rjansen/CODE/MadCapIdea/FrontEndWebSite'
@ ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css 6:4876-4928
Child extract-text-webpack-plugin:
[0] ./~/css-loader/lib/css-base.js 2.26 kB {0} [built]
[1] ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css 154 kB {0} [built]
ERROR in ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css
Module not found: Error: Can't resolve 'file-loader' in '/home/rjansen/CODE/MadCapIdea/FrontEndWebSite'
@ ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css 6:4445-4497 6:4520-4572
ERROR in ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css
Module not found: Error: Can't resolve 'url-loader' in '/home/rjansen/CODE/MadCapIdea/FrontEndWebSite'
@ ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css 6:4622-4676
ERROR in ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css
Module not found: Error: Can't resolve 'url-loader' in '/home/rjansen/CODE/MadCapIdea/FrontEndWebSite'
@ ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css 6:4707-4760
ERROR in ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css
Module not found: Error: Can't resolve 'url-loader' in '/home/rjansen/CODE/MadCapIdea/FrontEndWebSite'
@ ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css 6:4790-4842
ERROR in ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css
Module not found: Error: Can't resolve 'url-loader' in '/home/rjansen/CODE/MadCapIdea/FrontEndWebSite'
@ ./~/css-loader?importLoaders=1!./~/bootstrap/dist/css/bootstrap.css 6:4876-4928
I think you would need to do
Npm install
Before running webpack, as I didn't upload the node_modules folder (node creates big folder)
Honestly be so grateful if you could try it. It would pull down quite few files but after that, you should be able to webpack without errors
Like I say that's starting point after that you'd need to carry out the Inversify.js install and look at tsconfig.json to add Inversify.js bits
I just wanted to show it working before I added Inversify.js
Problem is to get your good start point you will need to suck down node packages
Sucks I know, but I try keep my repos as only source code
Thanks so much for looking so far
I will of course be happy to answer any c# queries you ever have in return for this favour
Looks like great library but I'm fairly new to webpack and typescript so probably me doing something wrong
Getting the same errors like Remo when cloning and trying to run it.
Like you said I run npm install
before starting. After that I executed npm run build-dev
.
Seems to be an issue with missing dependencies in the package.json
file-loader
and url-loader
are missing, installing them fixes some of the errors
Ah darn it, I thought Npm install would fix this
Leave this with me I'll clone it, get it to build after Npm install and let you guys know when I've pushed it again
Really appreciate the time guys (I'm new to webpack/Typescript). Lets me fix this, I'll post back here when it builds ok after a pull from github.
Sound ok?
You can test if it works, by removing the node_modules
folder. Then just run npm install
again and it should work.
Cool leave it with me, sorry guys
I'll ping you when I've got it working without Inversify.js in it
So it will be exactly what I have before adding Inversify.js
Should be ok, I've just forgotten to use --save-dev in few places
I'll buy you boys a beer if we can get me working
;-)
@lholznagel @remojansen Ok I just pushed up a new git repo which should allow my raw code (without Inversify.js) to build
That should all just work
It should not work after step 5, but it did in 4 (at least thats what happens for me)
Ok so I have managed to get it to work and I have created a PR for your project. I also changed your code to inject your class Foo
. Just to be sure that everything works.
The PR can be found at https://github.com/sachabarber/MadCapIdea/pull/1
@sachabarber thanks for your being patient @lholznagel thanks for giving me a hand 👍
@remojansen you absolute star thanks so much
If you are ever in London I'll buy you a beer, or Brighton where I actually live
No problem @sachabarber happy to help :+1:
@remojansen honestly mate really appreciate that. Like I say if you find yourself in London ping me i'll take you out for a beer.
BTW do you not sleep you push that PR through at like 1:00am or something, yikes
@sachabarber haha yes sometimes my most productive times are my "insomnia times" :rofl:
@remojansen take it you don't have kids, think they are real reason I lost mvp
Was just too tired
I would love to use this in my project. But it seems to blow up when im trying to install it
And this is where the types that I EXCPLICTITY installed via command line like npm install --save @types/react live
My setup that works
So before I installed Inversify 2.0, everything was working very well.
I had this tsconfig.json file
And this package.json
So then I followed instructions here : https://github.com/inversify/InversifyJS#installation
So for me that meant doing the following
As I say my setup has a top level node_modules folder with @Types inside it. After installing inversify I Don't see any additional types added in the node_modules\@Types folder , even though I believe inversify (The InversifyJS type definitions are included in the inversify npm package.)
So when I then run this new setup. I get a tonne of errors from the webpack command line.
Loads of line starting with this sort of thing error in [at-loader]
My setup was working without these changes for inversify, although I should point out that it is not able to find typing information for installed types for other things either, it does however work completely fine at runtime.
I have raised a StackOverflow for that : http://stackoverflow.com/questions/43789778/webpack-typescript-react-module-not-found
I should point out I am new to Typescript/Webpack, but any help would be greatly appreciated