I would like to download node packages better, and only if they do not exist, download the bower package.
I would just use the node package only as recommended on the Webpack website, but I need to download the library, which is only in bower, https://github.com/Stamplay/stamplay-js-sdk and https://github.com / Stamplay / angular-stamplay
I installed https://github.com/lpiepiora/bower-webpack-plugin
But when I run webpack-dev-server -d --watch , the error appears in the chrome console:
Uncaught TypeError: angular.module is not a function(anonymous function) @ app.js:8__webpack_require__ @ bootstrap 6cecf8d96fb5a1205f10:19(anonymous function) @ bootstrap 6cecf8d96fb5a1205f10:39__webpack_require__ @ bootstrap 6cecf8d96fb5a1205f10:19(anonymous function) @ bootstrap 6cecf8d96fb5a1205f10:39(anonymous function) @ bootstrap 6cecf8d96fb5a1205f10:39 angular.js:68Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to: Error: [$injector:nomod] Module 'app' 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. (anonymous function) @ app.js: 8__webpack_require__ @ bootstrap 6cecf8d96fb5a1205f10: Uncaught TypeError: angular.module is not a function(anonymous function) @ app.js:8__webpack_require__ @ bootstrap 6cecf8d96fb5a1205f10:19(anonymous function) @ bootstrap 6cecf8d96fb5a1205f10:39__webpack_require__ @ bootstrap 6cecf8d96fb5a1205f10:19(anonymous function) @ bootstrap 6cecf8d96fb5a1205f10:39(anonymous function) @ bootstrap 6cecf8d96fb5a1205f10:39 angular.js:68Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to: Error: [$injector:nomod] Module 'app' 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. 39__webpack_require__ @ bootstrap 6cecf8d96fb5a1205f10: Uncaught TypeError: angular.module is not a function(anonymous function) @ app.js:8__webpack_require__ @ bootstrap 6cecf8d96fb5a1205f10:19(anonymous function) @ bootstrap 6cecf8d96fb5a1205f10:39__webpack_require__ @ bootstrap 6cecf8d96fb5a1205f10:19(anonymous function) @ bootstrap 6cecf8d96fb5a1205f10:39(anonymous function) @ bootstrap 6cecf8d96fb5a1205f10:39 angular.js:68Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to: Error: [$injector:nomod] Module 'app' 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.
In webpack.config I add ..
plugins: [ ... , new webpack.ProvidePlugin({ Q: 'q', store: 'store.js', Stamplay: 'stamplay-js-sdk' }) , new webpack.ResolverPlugin( [ new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin("bower.json", ["main"]) ], ["normal", "loader"] ) ], .... resolve: { root: [ path.join(__dirname, 'node_modules'), path.join(__dirname, 'bower_components') ],
But, as mentioned here , the Stamplay object Stamplay incorrect!
Attempt with CDN and angular -webpack-plugin
First add the script tag to index.html ..
Second, add external elements to webpack.config ..
externals: { stamplay: 'Stamplay' },
And finally, new AngularPlugin in plugins on webpack.config
Thus, worsks , but I can not use angular-stamplay when I try, an error in the Stamplay module Stamplay : (
See the thread with this change here.
The full project is here: https://github.com/Ridermansb/webpackBowerStarter