Giter Site home page Giter Site logo

Comments (3)

Metnew avatar Metnew commented on May 2, 2024

Hi @ghostsquad, I don't know this secret. Just add next line to your entry. And configure webpack: add style-loader + css-loader (+ sass-loader, if you use SASS or similar preprocessor like Less). Does it solve your issue? In which part of your app you probably have a bug?

from suicrux.

ghostsquad avatar ghostsquad commented on May 2, 2024

Here's the full error:

ERROR in ./node_modules/css-loader!./node_modules/semantic-ui-css/semantic.css
Module not found: Error: Can't resolve './themes/default/assets/images/flags.png' in '/Users/wes/projects/react-dashboard/node_modules/semantic-ui-css'
 @ ./node_modules/css-loader!./node_modules/semantic-ui-css/semantic.css 6:118857-118908
 @ ./node_modules/semantic-ui-css/semantic.css
 @ ./src/index.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 babel-polyfill ./src/index.js

ERROR in ./node_modules/css-loader!./node_modules/semantic-ui-css/semantic.css
Module not found: Error: Can't resolve './themes/default/assets/fonts/icons.eot' in '/Users/wes/projects/react-dashboard/node_modules/semantic-ui-css'
 @ ./node_modules/css-loader!./node_modules/semantic-ui-css/semantic.css 6:154624-154674 6:154697-154747
 @ ./node_modules/semantic-ui-css/semantic.css
 @ ./src/index.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 babel-polyfill ./src/index.js

ERROR in ./node_modules/css-loader!./node_modules/semantic-ui-css/semantic.css
Module not found: Error: Can't resolve './themes/default/assets/fonts/icons.woff2' in '/Users/wes/projects/react-dashboard/node_modules/semantic-ui-css'
 @ ./node_modules/css-loader!./node_modules/semantic-ui-css/semantic.css 6:154797-154849
 @ ./node_modules/semantic-ui-css/semantic.css
 @ ./src/index.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 babel-polyfill ./src/index.js

ERROR in ./node_modules/css-loader!./node_modules/semantic-ui-css/semantic.css
Module not found: Error: Can't resolve './themes/default/assets/fonts/icons.woff' in '/Users/wes/projects/react-dashboard/node_modules/semantic-ui-css'
 @ ./node_modules/css-loader!./node_modules/semantic-ui-css/semantic.css 6:154880-154931
 @ ./node_modules/semantic-ui-css/semantic.css
 @ ./src/index.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 babel-polyfill ./src/index.js

ERROR in ./node_modules/css-loader!./node_modules/semantic-ui-css/semantic.css
Module not found: Error: Can't resolve './themes/default/assets/fonts/icons.ttf' in '/Users/wes/projects/react-dashboard/node_modules/semantic-ui-css'
 @ ./node_modules/css-loader!./node_modules/semantic-ui-css/semantic.css 6:154961-155011
 @ ./node_modules/semantic-ui-css/semantic.css
 @ ./src/index.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 babel-polyfill ./src/index.js

ERROR in ./node_modules/css-loader!./node_modules/semantic-ui-css/semantic.css
Module not found: Error: Can't resolve './themes/default/assets/fonts/icons.svg' in '/Users/wes/projects/react-dashboard/node_modules/semantic-ui-css'
 @ ./node_modules/css-loader!./node_modules/semantic-ui-css/semantic.css 6:155045-155095
 @ ./node_modules/semantic-ui-css/semantic.css
 @ ./src/index.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 babel-polyfill ./src/index.js

My webpack config looks like this:

const isProduction = process.env.NODE_ENV === 'production';

const path = require('path');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const DashboardPlugin = require('webpack-dashboard/plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");


const modulesDirectory = path.resolve(__dirname, 'node_modules');
const sourceDirectory = path.resolve(__dirname, 'src');
const staticDirectory = path.resolve(__dirname, 'static');
const distDirectory = path.resolve(__dirname, 'dist');

// -------------------------------------------------------------------------- //

module.exports = {
  entry: [
    'babel-polyfill',
    path.resolve(sourceDirectory, 'index.js')
  ],
  output: {
    path: distDirectory,
    filename: 'index.js',
    publicPath: '/'
  },
  devtool: 'source-map', // any "source-map"-like devtool is possible
  devServer: {
    historyApiFallback: true,
  },
  module: {
    rules: [
      {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        enforce: 'pre',
        use: [
          {
            loader: 'babel-loader',
            options: {
              cacheDirectory: true
            }
          },
          {
            loader: 'eslint-loader'
          }
        ],
      },
      {
        test: /\.(ico|eot|otf|webp|ttf|woff2?|gif|png|jpe?g|svg)$/i,
        use: [
          {
            loader: 'file-loader',
            options: {
              limit: 100000,
              name: 'assets/[name].[sha1:hash:base64:8].[ext]'
            }
          }
        ]
      },
      {
        test: /\.css$/,
        include: /node_modules/,
        use: [
          {
            loader: 'style-loader'
          },
          {
            loader: 'css-loader',
          }
        ]
      },
      {
        test: /\.css$/,
        exclude: /node_modules/,
        use: [
          {
            loader: 'style-loader'
          },
          {
            loader: 'css-loader',
            options: {
              sourceMap: true,
              modules: true
            }
          },
          {
            loader: 'postcss-loader',
            options: {
              sourceMap: true
            }
          },
          {
            loader: 'resolve-url-loader'
          }
        ]
      }
    ]
  },
  resolve: {
    extensions: ['.js', '.jsx', '.json', '.css', '.jpeg', '.jpg', '.png', '.gif', '.svg'],
    alias: {
      '_': sourceDirectory,
      'react': 'preact-compat',
      'react-dom': 'preact-compat'
    },
    modules: [
      sourceDirectory,
      modulesDirectory
    ]
  },
  plugins: [
    new DashboardPlugin(),
    new CopyWebpackPlugin([
      {
        from: staticDirectory,
        to: distDirectory
      }
    ]),
    new HtmlWebpackPlugin({
      title: 'React Dashboard',
      filename: path.resolve(distDirectory, 'index.html')
    }),
    new ManifestPlugin()
  ]
};

I'm almost to the point where I just want to vendor in the necessary themes and icons/fonts straight from semantic-ui source

from suicrux.

Metnew avatar Metnew commented on May 2, 2024

@ghostsquad I think it would be better if you modify your current project's webpack config to a similar config in the starter. It would be easier to debug (from my point of view) + probably your issue disappear after that. I faced similar issue when I was working on vue-element-starter, but it was resolved after resolve-url-loader was added.

from suicrux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.