0

我在尝试使用 Angular FullStack 生成器导入 UIkit 时遇到此错误:

Module 'uikit' 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.

这就是我所做的:

webpack.make.js

    if(TEST) {
        config.entry = {};
    } else {
        config.entry = {
            app: './client/app/app.js',
            polyfills: './client/polyfills.js',
            vendor: [
                'angular',
                'angular-animate',
                'angular-aria',
                'angular-cookies',
                'angular-resource',

                'angular-sanitize',


                'angular-ui-router',
                'lodash',

                'uikit'
            ]
        };
    }

应用程序.js

...
import uikit from 'uikit';
...

angular.module('myApp', [ngCookies, ngResource, ngSanitize, uiRouter, uikit])

但是,我可以通过将以下内容添加到我的 app.scss 来使用样式指令:

@import'~uikit/dist/css/uikit.css';

但是,如果我不导入 JS 模块,我会得到UIkit is not defined.

如何正确地将 UIkit 导入我的项目?

提前致谢 :)

4

1 回答 1

3

按照文档,这对我有用:

  1. 不要uikit 供应商添加到 webpack.make.js
  2. 插入import UIkit from 'uikit';到我的 app.js
于 2017-06-07T17:24:53.977 回答