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

01-intro does not work #8

Open
ryaa opened this issue Feb 18, 2017 · 1 comment
Open

01-intro does not work #8

ryaa opened this issue Feb 18, 2017 · 1 comment

Comments

@ryaa
Copy link

ryaa commented Feb 18, 2017

Followed the instructions and running webpack command for 01-intro gives and error. This could be that it is not webpack 2 compatible or smth...

@ryaa
Copy link
Author

ryaa commented Feb 19, 2017

Had to install node modules

npm i babel-loader babel-core babel-preset-es2015 babel-plugin-transform-es2015-modules-commonjs

and make some changes to webpack.config.js to make it to work (below is the config with my changes)

'use strict';

const NODE_ENV = process.env.NODE_ENV || 'development';
const webpack = require('webpack');

module.exports = {
  entry:  "./home",
  output: {
    filename: "build.js",
    library:  "home"
  },

  watch: NODE_ENV == 'development',

  watchOptions: {
    aggregateTimeout: 100
  },

  devtool: NODE_ENV == 'development' ? "cheap-inline-module-source-map" : null,

  plugins: [
    new webpack.DefinePlugin({
      NODE_ENV: JSON.stringify(NODE_ENV),
      LANG:     JSON.stringify('ru')
    })
  ],

  resolve: {
    modules: ['node_modules'],
    extensions:         ['.js']
  },

  resolveLoader: {
    modules: ['node_modules'],
    extensions:         ['.js']
  },


  module: {

    loaders: [{
      test:   /\.js$/,
      loader: 'babel-loader?presets[]=es2015'
    }]

  }

};


if (NODE_ENV == 'production') {
  module.exports.plugins.push(
      new webpack.optimize.UglifyJsPlugin({
        compress: {
          // don't show unreachable variables etc
          warnings:     false,
          drop_console: true,
          unsafe:       true
        }
      })
  );
}

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

1 participant