Git Product home page Git Product logo

Comments (10)

bertho-zero avatar bertho-zero commented on May 18, 2024

You forgot the rule for .css files and you probably forgot to remove the sass-loader by copying the plugin used for sass

Try to update your repo with the latest version of it and try this config (not tested):

require('babel-polyfill');

// Webpack config for development
var fs = require('fs');
var path = require('path');
var webpack = require('webpack');
var helpers = require('./helpers');

var assetsPath = path.resolve(__dirname, '../static/dist');
var host = (process.env.HOST || 'localhost');
var port = (+process.env.PORT + 1) || 3001;

// https://github.com/halt-hammerzeit/webpack-isomorphic-tools
var WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin');
var webpackIsomorphicToolsPlugin = new WebpackIsomorphicToolsPlugin(require('./webpack-isomorphic-tools'));

var babelrc = fs.readFileSync('./.babelrc');
var babelrcObject = {};

try {
  babelrcObject = JSON.parse(babelrc);
} catch (err) {
  console.error('==>     ERROR: Error parsing your .babelrc.');
  console.error(err);
}

var babelrcObjectDevelopment = babelrcObject.env && babelrcObject.env.development || {};

// merge global and dev-only plugins
var combinedPlugins = babelrcObject.plugins || [];
combinedPlugins = combinedPlugins.concat(babelrcObjectDevelopment.plugins);

var babelLoaderQuery = Object.assign({}, babelrcObject, babelrcObjectDevelopment, { plugins: combinedPlugins });
delete babelLoaderQuery.env;

babelLoaderQuery.presets = babelLoaderQuery.presets.map(function (v) {
  return v === 'es2015' ? ['es2015', { modules: false }] : v;
});

var validDLLs = helpers.isValidDLLs('vendor', assetsPath);
if (process.env.WEBPACK_DLLS === '1' && !validDLLs) {
  process.env.WEBPACK_DLLS = '0';
  console.warn('webpack dlls disabled');
}

var webpackConfig = module.exports = {
  devtool: 'inline-source-map',
  context: path.resolve(__dirname, '..'),
  entry: {
    'main': [
      'webpack-hot-middleware/client?path=http://' + host + ':' + port + '/__webpack_hmr',
      'react-hot-loader/patch',
      'bootstrap-loader',
      'font-awesome-webpack!./src/theme/font-awesome.config.js',
      './src/client.js'
    ]
  },
  output: {
    path: assetsPath,
    filename: '[name]-[hash].js',
    chunkFilename: '[name]-[chunkhash].js',
    publicPath: 'http://' + host + ':' + port + '/dist/'
  },
  performance: {
    hints: false
  },
  module: {
    rules: [
      {
        test: /\.jsx?$/,
        loader: 'happypack/loader?id=jsx',
        include: [path.resolve(__dirname, '../src')]
      }, {
        test: /\.json$/,
        loader: 'happypack/loader?id=json',
        include: [path.resolve(__dirname, '../src')]
      }, {
        test: /\.less$/,
        loader: 'happypack/loader?id=less',
        include: [path.resolve(__dirname, '../src')]
      }, {
        test: /\.scss$/,
        loader: 'happypack/loader?id=sass',
        include: [path.resolve(__dirname, '../src')]
      }, {
        test: /\.css$/,
        loader: 'happypack/loader?id=css',
        include: [path.resolve(__dirname, '../src')]
      }, {
        test: /\.woff2?(\?v=\d+\.\d+\.\d+)?$/,
        loader: 'url-loader',
        options: {
          limit: 10240,
          mimetype: 'application/font-woff'
        }
      }, {
        test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
        loader: 'url-loader',
        options: {
          limit: 10240,
          mimetype: 'application/octet-stream'
        }
      }, {
        test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
        loader: 'file-loader'
      }, {
        test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
        loader: 'url-loader',
        options: {
          limit: 10240,
          mimetype: 'image/svg+xml'
        }
      }, {
        test: webpackIsomorphicToolsPlugin.regular_expression('images'),
        loader: 'url-loader',
        options: {
          limit: 10240
        }
      }
    ]
  },
  resolve: {
    modules: [
      'src',
      'node_modules'
    ],
    extensions: ['.json', '.js', '.jsx']
  },
  plugins: [
    // hot reload
    new webpack.HotModuleReplacementPlugin(),
    new webpack.IgnorePlugin(/webpack-stats\.json$/),
    new webpack.DefinePlugin({
      __CLIENT__: true,
      __SERVER__: false,
      __DEVELOPMENT__: true,
      __DEVTOOLS__: true  // <-------- DISABLE redux-devtools HERE
    }),
    webpackIsomorphicToolsPlugin.development(),

    new webpack.LoaderOptionsPlugin({
      test: /\.jsx?$/,
      happy: { id: 'jsx' }
    }),
    new webpack.LoaderOptionsPlugin({
      test: /\.less$/,
      happy: { id: 'less' }
    }),
    new webpack.LoaderOptionsPlugin({
      test: /\.scss$/,
      happy: { id: 'sass' }
    }),
    new webpack.LoaderOptionsPlugin({
      test: /\.css$/,
      happy: { id: 'css' }
    }),

    helpers.createHappyPlugin('jsx', [
      {
        loader: 'react-hot-loader/webpack'
      }, {
        loader: 'babel-loader',
        query: babelLoaderQuery
      }, {
        loader: 'eslint-loader'
      }
    ]),
    helpers.createHappyPlugin('less', [
      {
        loader: 'style-loader'
      }, {
        loader: 'css-loader',
        query: {
          modules: true,
          importLoaders: 2,
          sourceMap: true,
          localIdentName: '[local]___[hash:base64:5]'
        }
      }, {
        loader: 'autoprefixer-loader',
        query: {
          browser: 'last 2 version'
        }
      }, {
        loader: 'less-loader',
        query: {
          outputStyle: 'expanded',
          sourceMap: true
        }
      }
    ]),
    helpers.createHappyPlugin('sass', [
      {
        loader: 'style-loader'
      }, {
        loader: 'css-loader',
        query: {
          modules: true,
          importLoaders: 2,
          sourceMap: true,
          localIdentName: '[local]___[hash:base64:5]'
        }
      }, {
        loader: 'autoprefixer-loader',
        query: {
          browsers: 'last 2 version'
        }
      }, {
        loader: 'sass-loader',
        query: {
          outputStyle: 'expanded',
          sourceMap: true
        }
      }
    ]),
    helpers.createHappyPlugin('css', [
      {
        loader: 'style-loader'
      }, {
        loader: 'css-loader',
        query: {
          modules: false,
          importLoaders: 1,
          sourceMap: true,
          localIdentName: '[local]___[hash:base64:5]'
        }
      }, {
        loader: 'autoprefixer-loader',
        query: {
          browsers: 'last 2 version'
        }
      }
    ])
  ]
};

if (process.env.WEBPACK_DLLS === '1' && validDLLs) {
  helpers.installVendorDLL(webpackConfig, 'vendor');
}

from react-redux-universal-hot-example.

anhdn avatar anhdn commented on May 18, 2024

@bertho-zero Sorry, i updated rule for .css like your file and run "npm i" successful. But it's still errors like this

[2] ==> 🌎  API is running on port 3030
[2] ==> 💻  Send requests to http://localhost:3030
[1] [webpack-isomorphic-tools] [error] asset not found: ./node_modules/universal_components/lib/components/AppHeader/styles.scss
[1] [webpack-isomorphic-tools] [error] asset not found: ./node_modules/universal_components/assets/Style.scss
[1] [webpack-isomorphic-tools] [error] asset not found: ./node_modules/universal_components/lib/components/AppFooter/styles.scss
[1] [webpack-isomorphic-tools] [error] asset not found: ./node_modules/react-input-range/dist/react-input-range.css
[1] ----
[1] ==> ✅  (development) is running.
[1] ==> 💻  Open http://localhost:3000 in a browser to view the app.
[0] ./~/react-input-range/dist/react-input-range.css
[0] Module parse failed: /Users/anhdn/IdeaProjects/chotot-oneweb/node_modules/react-input-range/dist/react-input-range.css Unexpected token (1:0)
[0] You may need an appropriate loader to handle this file type.
[0] | .InputRange-slider {
[0] |   -webkit-appearance: none;
[0] |      -moz-appearance: none;
[0]  @ ./src/components/FilterOverlay/index.js 65:0-55
[0]  @ ./src/components/index.js
[0]  @ ./src/containers/AdvancedFilterPopup/index.js
[0]  @ ./src/containers/index.js
[0]  @ ./src/routes.js
[0]  @ ./src/client.js
[0]  @ multi webpack-hot-middleware/client?path=http://localhost:3001/__webpack_hmr react-hot-loader/patch bootstrap-loader font-awesome-webpack!./src/theme/font-awesome.config.js ./src/client.js

from react-redux-universal-hot-example.

anhdn avatar anhdn commented on May 18, 2024

i add extensions: ['less', 'scss','css'] to handle css file on webpack-isomorphic-tools.js

from react-redux-universal-hot-example.

anhdn avatar anhdn commented on May 18, 2024

@bertho-zero I can run on production but on development it has errors like that. Do you have any suggestion?

from react-redux-universal-hot-example.

bertho-zero avatar bertho-zero commented on May 18, 2024

It's an error due to rc version of extract-text-webpack-plugin, try to down your version at the 2.0.0-beta.5.

npm i [email protected] -D

from react-redux-universal-hot-example.

anhdn avatar anhdn commented on May 18, 2024

i updated npm i [email protected] -D but still errors. It might like this issue webpack-contrib/sass-loader#69

from react-redux-universal-hot-example.

anhdn avatar anhdn commented on May 18, 2024
{
        test: /\.scss$/,
        loader: 'happypack/loader?id=sass',
        include: [path.resolve(__dirname, '../src'), path.resolve(__dirname, '../node_modules/')]
      }

I include node_modules to build sass to Solve the issue. @bertho-zero thank you!

from react-redux-universal-hot-example.

anhdn avatar anhdn commented on May 18, 2024

image
Do you guest the issue while "npm run dev" succcess?

from react-redux-universal-hot-example.

bertho-zero avatar bertho-zero commented on May 18, 2024

Normally you should not see all this if the DLLs file is not created,

You can run npm run build-dlls for replace it.

Normally you have this: https://github.com/bertho-zero/react-redux-universal-hot-example/blob/master/webpack/dev.config.js#L40L44

from react-redux-universal-hot-example.

anhdn avatar anhdn commented on May 18, 2024

@bertho-zero thank you! It's cache of webpack dll. I clear and it works!

from react-redux-universal-hot-example.

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.