本文介绍了WebPACK中有凉亭支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 请问我喜欢pferably加载$ P $节点包,且仅当不存在,加载亭子包。Try with bower-webpack-pluginI installed https://github.com/lpiepiora/bower-webpack-pluginBut when I run webpack-dev-server -d --watch the error is displayed in 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:39angular.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.Try with ResolverPlugin (see Webpack docs)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, like mention here the Stamplay object is not correct!Trying with CDN and angular-webpack-pluginFirst add script tag into index.html ..Second, add externals in webpack.config ..externals: { stamplay: 'Stamplay'},And finally .. new AngularPlugin into plugins on webpack.configThis way, worsks but I cant use angular-stamplay, when I try, a error in module stamplay apper. :(See branch with this change hereThe full project is here: https://github.com/Ridermansb/webpackBowerStarter 解决方案 Ok, tried your project from git https://github.com/Ridermansb/webpackBowerStarterAnd as mentioned at https://github.com/lpiepiora/bower-webpack-plugin/issues/20 I too had that Cannot resolve module 'stamplay-js-sdk' issue , then in webpackBowerStarter directory I did bower install stamplay-js-sdk then sudo npm run build and voila! It was done.On npm run start which is same as webpack-dev-server -d --watch I get http://localhost:8080/webpack-dev-server/ likeAnd console sayssry if u meant something else. Does this resolves your issue ? 这篇关于WebPACK中有凉亭支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!