flipace / lovli.js

A boilerplate for developing react+redux applications with rethinkdb/horizon as realtime database and express for the server.
MIT License
558 stars 35 forks source link

Error while building #3

Open tacone opened 8 years ago

tacone commented 8 years ago

Hello :) I tried to build from the master branch:

$ npm run build 

> lovli.js@0.7.2 build /home/user/Code/horizon/lovli.js
> webpack --config=config/webpack/webpack.config.client.prod.js && webpack --config=config/webpack/webpack.config.server.js

Built client in 3.881s.
Hash: 3bc8a0846f62d813fe74
Version: webpack 1.13.0
Time: 3882ms
   [0] multi app 28 bytes {0} [built]
    + 472 hidden modules

ERROR in /home/user/Code/horizon/lovli.js/~/css-loader!/home/user/Code/horizon/lovli.js/static/vendor/font-awesome/css/font-awesome.min.css
Module build failed: TypeError: Cannot read property 'value' of undefined
    at reduce (/home/user/Code/horizon/lovli.js/node_modules/cssnano/dist/lib/reduceTimingFunctions.js:44:26)
    at walk (/home/user/Code/horizon/lovli.js/node_modules/postcss-value-parser/lib/walk.js:7:22)
    at ValueParser.walk (/home/user/Code/horizon/lovli.js/node_modules/postcss-value-parser/lib/index.js:18:5)
    at /home/user/Code/horizon/lovli.js/node_modules/cssnano/dist/lib/reduceTimingFunctions.js:65:72
    at /home/user/Code/horizon/lovli.js/node_modules/postcss/lib/container.js:100:28
    at /home/user/Code/horizon/lovli.js/node_modules/postcss/lib/container.js:81:26
    at Rule.each (/home/user/Code/horizon/lovli.js/node_modules/postcss/lib/container.js:68:22)
    at Rule.walk (/home/user/Code/horizon/lovli.js/node_modules/postcss/lib/container.js:80:21)
    at /home/user/Code/horizon/lovli.js/node_modules/postcss/lib/container.js:83:32
    at Root.each (/home/user/Code/horizon/lovli.js/node_modules/postcss/lib/container.js:68:22)
    at Root.walk (/home/user/Code/horizon/lovli.js/node_modules/postcss/lib/container.js:80:21)
    at Root.walkDecls (/home/user/Code/horizon/lovli.js/node_modules/postcss/lib/container.js:98:25)
    at /home/user/Code/horizon/lovli.js/node_modules/cssnano/dist/lib/reduceTimingFunctions.js:64:13
    at LazyResult.run (/home/user/Code/horizon/lovli.js/node_modules/postcss/lib/lazy-result.js:206:20)
    at /home/user/Code/horizon/lovli.js/node_modules/postcss/lib/lazy-result.js:120:37
    at LazyResult.asyncTick (/home/user/Code/horizon/lovli.js/node_modules/postcss/lib/lazy-result.js:134:15)
    at /home/user/Code/horizon/lovli.js/node_modules/postcss/lib/lazy-result.js:132:27
    at LazyResult.asyncTick (/home/user/Code/horizon/lovli.js/node_modules/postcss/lib/lazy-result.js:134:15)
    at /home/user/Code/horizon/lovli.js/node_modules/postcss/lib/lazy-result.js:132:27
    at LazyResult.asyncTick (/home/user/Code/horizon/lovli.js/node_modules/postcss/lib/lazy-result.js:134:15)
    at /home/user/Code/horizon/lovli.js/node_modules/postcss/lib/lazy-result.js:132:27
    at LazyResult.asyncTick (/home/user/Code/horizon/lovli.js/node_modules/postcss/lib/lazy-result.js:134:15)
    at /home/user/Code/horizon/lovli.js/node_modules/postcss/lib/lazy-result.js:125:31
 @ /home/user/Code/horizon/lovli.js/static/vendor/font-awesome/css/font-awesome.min.css 4:14-96
Built server in 1.144s.
Hash: af13ec09bf81c490fa24
Version: webpack 1.13.0
Time: 1148ms
           Asset    Size  Chunks             Chunk Names
server.bundle.js  450 kB       0  [emitted]  main
  [18] ../db.js 109 bytes {0} [built]
  [19] ../page.js 103 bytes {0} [built]
  [20] ./devProps.js 141 bytes {0} [built]
    + 66 hidden modules

Also:

$ node --version
v6.2.0
flipace commented 8 years ago

This is interesting - you're on the latest version right? Could you check the contents of config/webpack/webpack.config.client.js?

tacone commented 8 years ago

Yes, latest from the master, with no modifications.

config/webpack/webpack.config.client.js

const path = require('path');
const webpack = require('webpack');
const chalk = require('chalk');
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const WebpackAnybarPlugin = require('webpack-anybar-plugin').default;

const basePath = path.join(__dirname, '../../source');
const buildPath = path.join(__dirname, '../../.build');
const staticPath = path.join(__dirname, '../../static');

module.exports = {
  target: 'web',
  context: __dirname,
  cache: true,
  entry: {
    app: [
      path.join(basePath, '/client/entry')
    ]
  },
  output: {
    path: buildPath,
    filename: 'client.bundle.js',
    publicPath: '/static/'
  },
  resolve: {
    extensions: ['', '.js', '.jsx', '.css'],
    root: basePath,
    alias: {
      utils: path.join(basePath, '/utils'),
      styles: path.join(basePath, '/client/styles'),
      images: path.join(staticPath, 'images'),
      static: path.join(staticPath)
    }
  },
  module: {
    loaders: [
      {
        test: /\.(jpe?g|png|gif|mp3|ogg|wav|ogv|mov|mp4|svg|ttf|eot|woff)/,
        loader: 'file?limit=2000',
        include: staticPath
      },
      {
        test: /\.jsx?$/,
        loader: 'babel',
        include: basePath
      },
      {
        test: /\.jsx?$/,
        loader: 'script',
        include: path.join(staticPath, 'vendor')
      },
      {
        test : /\.json$/,
        loader : 'json'
      },
      {
        // vendor css can be put into the "static/vendor" folder, it won't be localized then
        test: /\.(css)$/,
        loader: 'style!css',
        include: path.join(staticPath, 'vendor')
      },
      {
        name: 'local-css-config',
        // css inside the source folder will be localized by default. see https://github.com/css-modules/css-modules
        test: /\.(css)$/,
        loader: 'style!css?modules&importLoaders=1&localIdentName=[local]_[hash:base64:5]!postcss',
        include: basePath
      }
    ]
  },
  postcss: function postcssPlugins() {
    return [
      require('autoprefixer'),
      require('css-mqpacker'),
      require('postcss-nested'),
      require('postcss-discard-comments')({
        removeAll: true
      })
    ];
  },
  browser: {
    child_process: 'empty',
    net: 'empty',
    tls: 'empty',
    fs: 'empty'
  },
  plugins: [
    new ProgressBarPlugin({
      format: `${chalk.blue.bold('Building client bundle')} [:bar] ${chalk.green.bold(':percent')} (:elapsed seconds)`,
      renderThrottle: 100,
      summary: false,
      customSummary: (t) => {
        return console.log(chalk.blue.bold(`Built client in ${t}.`));
      }
    }),
    new webpack.DefinePlugin({
      BUILD_TIME: JSON.stringify((new Date()).getTime())
    }),
    new webpack.optimize.OccurenceOrderPlugin(),
    new WebpackAnybarPlugin({
      port: 1738
    })
  ]
};

config/webpack/webpack.config.client.prod.js

const webpack = require('webpack');
const config = require('./webpack.config.client');
const _ = require('lodash');

module.exports = _.assign(_.clone(config), {
  devtool: 'eval',
  plugins: (config.plugins || []).concat([
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify('production')
    }),
    new webpack.NoErrorsPlugin(),
    new webpack.optimize.DedupePlugin(),
    new webpack.optimize.UglifyJsPlugin({
      compress: { warnings: false }
    }),
    new webpack.optimize.AggressiveMergingPlugin(),
    new webpack.optimize.OccurenceOrderPlugin(true)
  ])
});
tacone commented 8 years ago

As a side node, the development mode start correctly.