Module not found: Error: Cannot resolve module 'semantic-ui-css'

自作多情 提交于 2020-03-18 06:18:19

问题


I'm trying to use Webpack + Semantic UI but without success. I tried...

  1. npm i semantic-ui-css
  2. In my index.js.. import semantic from 'semantic-ui-css'
  3. I add configuration into my webpack.config.js

    resolve: { 
          alias: {'semantic-ui': path.join(__dirname, "node_modules", "semantic-ui-css", semantic.min.js")
    }
    

But when I try to buid... error..

ERROR in ./src/index.js Module not found: Error: Cannot resolve module 'sematic-ui-css' in /Users/ridermansb/Projects/boilerplate-projects/vue/src @ ./src/index.js 15:20-45

Full source here


回答1:


All you have to do:

css: import 'semantic-ui-css/semantic.css';

js: import 'semantic-ui-css/semantic.js';

This solves my problem with webpack and react.




回答2:


If you came here trying to use 'semantic-ui-react' you need to install 'semantic-ui-css' seperatly to grab the css files:

yarn add semantic-ui-css

and then import it in the index.js

import 'semantic-ui-css/semantic.min.css';


来源:https://stackoverflow.com/questions/39355301/module-not-found-error-cannot-resolve-module-semantic-ui-css

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!