Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use with semantic-ui-react #76

Open
evangow opened this issue Aug 28, 2017 · 2 comments
Open

Use with semantic-ui-react #76

evangow opened this issue Aug 28, 2017 · 2 comments

Comments

@evangow
Copy link

evangow commented Aug 28, 2017

While the below refers to semantic-ui, I would guess the same problem occurs with other ui frameworks.

Installed the boilerplate

$ git clone https://github.com/jhen0409/react-chrome-extension-boilerplate.git
$ npm install

Installed semantic ui from https://react.semantic-ui.com/usage

$ npm install semantic-ui-react --save
$ npm install semantic-ui-css --save

Imported semantic css inside /app/containers/Root.js
import 'semantic-ui-css/semantic.min.css';

I then get the following errors

ERROR in ./~/css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!./~/postcss-loader!./~/semantic-ui-css/semantic.min.css
Module not found: Error: Cannot resolve module 'themes/default/assets/images/flags.png' in /Users/evangow/workspace/tuts/boilerplate-wsemui/node_modules/semantic-ui-css
 @ ./~/css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!./~/postcss-loader!./~/semantic-ui-css/semantic.min.css 6:202659-202708

ERROR in ./~/css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!./~/postcss-loader!./~/semantic-ui-css/semantic.min.css
Module not found: Error: Cannot resolve module 'themes/default/assets/fonts/icons.eot' in /Users/evangow/workspace/tuts/boilerplate-wsemui/node_modules/semantic-ui-css
 @ ./~/css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!./~/postcss-loader!./~/semantic-ui-css/semantic.min.css 6:264152-264200 6:264218-264266

ERROR in ./~/css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!./~/postcss-loader!./~/semantic-ui-css/semantic.min.css
Module not found: Error: Cannot resolve module 'themes/default/assets/fonts/icons.woff2' in /Users/evangow/workspace/tuts/boilerplate-wsemui/node_modules/semantic-ui-css
 @ ./~/css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!./~/postcss-loader!./~/semantic-ui-css/semantic.min.css 6:264315-264365

ERROR in ./~/css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!./~/postcss-loader!./~/semantic-ui-css/semantic.min.css
Module not found: Error: Cannot resolve module 'themes/default/assets/fonts/icons.woff' in /Users/evangow/workspace/tuts/boilerplate-wsemui/node_modules/semantic-ui-css
 @ ./~/css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!./~/postcss-loader!./~/semantic-ui-css/semantic.min.css 6:264395-264444

ERROR in ./~/css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!./~/postcss-loader!./~/semantic-ui-css/semantic.min.css
Module not found: Error: Cannot resolve module 'themes/default/assets/fonts/icons.ttf' in /Users/evangow/workspace/tuts/boilerplate-wsemui/node_modules/semantic-ui-css
 @ ./~/css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!./~/postcss-loader!./~/semantic-ui-css/semantic.min.css 6:264473-264521

ERROR in ./~/css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!./~/postcss-loader!./~/semantic-ui-css/semantic.min.css
Module not found: Error: Cannot resolve module 'themes/default/assets/fonts/icons.svg' in /Users/evangow/workspace/tuts/boilerplate-wsemui/node_modules/semantic-ui-css
 @ ./~/css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!./~/postcss-loader!./~/semantic-ui-css/semantic.min.css 6:264554-264602

Trying to solve this, I then installed file-loader and url-loader
npm install --save-dev file-loader
npm install --save-dev url-loader

And I updated /webpack/dev.config.js to use these loaders for the various image file types.

module: {
    loaders: [
      {
        test: /\.js$/,
        loader: 'babel',
        exclude: /node_modules/,
        query: {
          presets: ['react-hmre']
        }
      },
      {
        test: /\.css$/,
        loaders: [
          'style',
          'css?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]',
          'postcss'
        ]
      },
      {
        test: /\.(png|gif)$/,
        loader: 'url-loader?limit=1024&name=[name]-[hash:8].[ext]!image-webpack-loader'
      },
      {
        test: /\.jpg$/,
        loader: 'file-loader'
      },
      {
        test: /\.(ttf|eot|svg|woff2?)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
        loader: 'file-loader'
      }
    ]
  }

After updating /webpack.dev.config, I continue to get the exact same error.

@HaveF
Copy link

HaveF commented Sep 5, 2017

@evangow you can put css file to chrome/assets/ directly, and use it in xxx.pug file directly. it is the easiest way.

@nagacoder
Copy link

some issue, any suggestion for this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants