<commit_before>'use strict';
const verifyNoBrowserErrors = require('./helpers').verifyNoBrowserErrors;
const scrollToEl = require('./helpers').scrollToEl;
const fixFFTest = require('./helpers').fixFFTest;
const eachNth = require('./helpers').eachNth;

const URL = 'index.html';

function waitForInit() {
  var EC = protractor.ExpectedConditions;
  var $apiInfo = $('api-info');
  var $errorMessage = $('.redoc-error')
  browser.wait(EC.or(EC.visibilityOf($apiInfo), EC.visibilityOf($errorMessage)), 60000);
}

function basicTests(swaggerUrl, title) {
  describe(`Basic suite for ${title}`, () => {
    let specUrl = URL;
    if (swaggerUrl) {
      specUrl += `?url=${encodeURIComponent(swaggerUrl)}`;
    }

    beforeEach((done) => {
      browser.get(specUrl);
      waitForInit();
      fixFFTest(done);
    });

    afterEach(() => {
      verifyNoBrowserErrors();
    });

    it('should init redoc without errors', (done) => {
      let $redoc = $('redoc');
      expect($redoc.isPresent()).toBe(true);
      setTimeout(() => {
        let $methods = $$('method');
        expect($methods.count()).toBeGreaterThan(0);
        done();
      });
    });
  });
}

basicTests(null, 'Extended Petstore');

describe('Scroll sync', () => {
  let specUrl = URL;

  beforeEach((done) => {
    browser.get(specUrl);
    waitForInit();
    fixFFTest(done);
  });

  it('should update active menu entries on page scroll forwards', () => {
    scrollToEl('[section="tag/store"]').then(() => {
      expect($('.menu-item.active > .menu-item-header').getInnerHtml()).toContain('store');
      expect($('.selected-tag').getInnerHtml()).toContain('store');
    });
  });

  it('should update active menu entries on page scroll backwards', () => {
    scrollToEl('[operation-id="getPetById"]').then(() => {
      expect($('.menu-item.menu-item-depth-1.active .menu-item-header').getInnerHtml()).toContain('pet');
      expect($('.selected-tag').getInnerHtml()).toContain('pet');
      expect($('.menu-item.menu-item-depth-2.active .menu-item-header').getInnerHtml()).toContain('Find pet by ID');
      expect($('.selected-endpoint').getInnerHtml()).toContain('Find pet by ID');
    });
  });
});

describe('Language tabs sync', () => {
  let specUrl = URL;

  beforeEach((done) => {
    browser.get(specUrl);
    waitForInit();
    fixFFTest(done);
  });

  it('should sync language tabs', () => {
    var $item = $$('[operation-id="addPet"] tabs > ul > li').last();
    // check if correct item
    expect($item.getText()).toContain('PHP');
    var EC = protractor.ExpectedConditions;
    browser.wait(EC.elementToBeClickable($item), 5000);
    $item.click().then(() => {
      expect($('[operation-id="updatePet"] li.active').getText()).toContain('PHP');
    });
  });
});

if (process.env.JOB === 'e2e-guru') {
  describe('APIs.guru specs test', ()=> {

    // global.apisGuruList was loaded in onPrepare method of protractor config
    let apisGuruList = global.apisGuruList;

    // Remove certain APIs that are known to cause problems
    delete apisGuruList['motaword.com']; // invalid (see https://github.com/BigstickCarpet/swagger-parser/issues/26)
    delete apisGuruList['learnifier.com']; // allof object and no type
    delete apisGuruList['googleapis.com:mirror']; // bad urls in images
    delete apisGuruList['googleapis.com:discovery']; // non-string references
    delete apisGuruList['clarify.io']; // non-string references
    //delete apisGuruList['pushpay.com']; // https://github.com/Rebilly/ReDoc/issues/30
    delete apisGuruList['bbci.co.uk']; // too big
    delete apisGuruList['bbc.com']; // too big

    // run quick version of e2e test on all builds except releases
    if (process.env.TRAVIS && !process.env.TRAVIS_TAG) {
      console.log('Running on short APIs guru list');
      apisGuruList = eachNth(apisGuruList, 10);
    } else {
      console.log('Running on full APIs guru list')
    }

    for (let apiName of Object.keys(apisGuruList)) {
      let apiInfo = apisGuruList[apiName].versions[apisGuruList[apiName].preferred];
      let url = apiInfo.swaggerUrl;

      // temporary hack due to this issue: https://github.com/substack/https-browserify/issues/6
      url = url.replace('https://', 'http://');
      url = url.replace('apis-guru.github.io/', 'apis-guru.github.io:80/');
      basicTests(url, `${apiName}:${apiInfo.info.version}\n${url}`);
    }
  });
}
<commit_msg>Fix e2e test<commit_after>'use strict';
const verifyNoBrowserErrors = require('./helpers').verifyNoBrowserErrors;
const scrollToEl = require('./helpers').scrollToEl;
const fixFFTest = require('./helpers').fixFFTest;
const eachNth = require('./helpers').eachNth;

const URL = 'index.html';

function waitForInit() {
  var EC = protractor.ExpectedConditions;
  var $apiInfo = $('api-info');
  var $errorMessage = $('.redoc-error')
  browser.wait(EC.or(EC.visibilityOf($apiInfo), EC.visibilityOf($errorMessage)), 60000);
}

function basicTests(swaggerUrl, title) {
  describe(`Basic suite for ${title}`, () => {
    let specUrl = URL;
    if (swaggerUrl) {
      specUrl += `?url=${encodeURIComponent(swaggerUrl)}`;
    }

    beforeEach((done) => {
      browser.get(specUrl);
      waitForInit();
      fixFFTest(done);
    });

    afterEach(() => {
      verifyNoBrowserErrors();
    });

    it('should init redoc without errors', (done) => {
      let $redoc = $('redoc');
      expect($redoc.isPresent()).toBe(true);
      setTimeout(() => {
        let $methods = $$('method');
        expect($methods.count()).toBeGreaterThan(0);
        done();
      });
    });
  });
}

basicTests(null, 'Extended Petstore');

describe('Scroll sync', () => {
  let specUrl = URL;

  beforeEach((done) => {
    browser.get(specUrl);
    waitForInit();
    fixFFTest(done);
  });

  it('should update active menu entries on page scroll forwards', () => {
    scrollToEl('[section="tag/store"]').then(() => {
      expect($('.menu-item.menu-item-depth-1.active > .menu-item-header').getInnerHtml()).toContain('store');
      expect($('.selected-tag').getInnerHtml()).toContain('store');
    });
  });

  it('should update active menu entries on page scroll backwards', () => {
    scrollToEl('[operation-id="getPetById"]').then(() => {
      expect($('.menu-item.menu-item-depth-1.active .menu-item-header').getInnerHtml()).toContain('pet');
      expect($('.selected-tag').getInnerHtml()).toContain('pet');
      expect($('.menu-item.menu-item-depth-2.active .menu-item-header').getInnerHtml()).toContain('Find pet by ID');
      expect($('.selected-endpoint').getInnerHtml()).toContain('Find pet by ID');
    });
  });
});

describe('Language tabs sync', () => {
  let specUrl = URL;

  beforeEach((done) => {
    browser.get(specUrl);
    waitForInit();
    fixFFTest(done);
  });

  it('should sync language tabs', () => {
    var $item = $$('[operation-id="addPet"] tabs > ul > li').last();
    // check if correct item
    expect($item.getText()).toContain('PHP');
    var EC = protractor.ExpectedConditions;
    browser.wait(EC.elementToBeClickable($item), 5000);
    $item.click().then(() => {
      expect($('[operation-id="updatePet"] li.active').getText()).toContain('PHP');
    });
  });
});

if (process.env.JOB === 'e2e-guru') {
  describe('APIs.guru specs test', ()=> {

    // global.apisGuruList was loaded in onPrepare method of protractor config
    let apisGuruList = global.apisGuruList;

    // Remove certain APIs that are known to cause problems
    delete apisGuruList['motaword.com']; // invalid (see https://github.com/BigstickCarpet/swagger-parser/issues/26)
    delete apisGuruList['learnifier.com']; // allof object and no type
    delete apisGuruList['googleapis.com:mirror']; // bad urls in images
    delete apisGuruList['googleapis.com:discovery']; // non-string references
    delete apisGuruList['clarify.io']; // non-string references
    //delete apisGuruList['pushpay.com']; // https://github.com/Rebilly/ReDoc/issues/30
    delete apisGuruList['bbci.co.uk']; // too big
    delete apisGuruList['bbc.com']; // too big

    // run quick version of e2e test on all builds except releases
    if (process.env.TRAVIS && !process.env.TRAVIS_TAG) {
      console.log('Running on short APIs guru list');
      apisGuruList = eachNth(apisGuruList, 10);
    } else {
      console.log('Running on full APIs guru list')
    }

    for (let apiName of Object.keys(apisGuruList)) {
      let apiInfo = apisGuruList[apiName].versions[apisGuruList[apiName].preferred];
      let url = apiInfo.swaggerUrl;

      // temporary hack due to this issue: https://github.com/substack/https-browserify/issues/6
      url = url.replace('https://', 'http://');
      url = url.replace('apis-guru.github.io/', 'apis-guru.github.io:80/');
      basicTests(url, `${apiName}:${apiInfo.info.version}\n${url}`);
    }
  });
}
<|endoftext|>


<commit_before>require('proof')(17, prove)

// Limited language that is ment to match specific entries in addition to
// winnowing by package and level. Select first by package name, then winnow by
// level or specifically by values in payload. Equality is coercive. Relative
// comparisons convert to numbers.
function prove (okay) {
    var Acceptor = require('..'), acceptor
    acceptor = new Acceptor(false, [])
    okay(!acceptor.acceptByProperties([{ qualifier: 'example', level: 'debug' }]), 'default drop')
    acceptor = new Acceptor(true, [])
    okay(!! acceptor.acceptByProperties([{ qualifier: 'example', level: 'debug' }]), 'default accept')
    acceptor = new Acceptor(false, [{
        path: '.',
        level: 'warn',
        accept: true
    }, {
        path: '.example.timer',
        level: 'debug',
        accept: true
    }, {
        path: '.example.equals',
        test: '$.tag && $.tag.indexOf &&  ~$.tag.indexOf("send")',
        accept: true
    }, {
        path: '.example.equals',
        test: '$.id == 1',
        accept: true
    }, {
        path: '.example.regex',
        test: '/a/.test($.value)',
        accept: true
    }, {
        path: '.example.and',
        test: '/a/.test($.id) && ~($.tag || []).indexOf("send")',
        accept: true
    }, {
        path: '.',
        test: '$.nope',
        accept: false
    }])
    okay(acceptor.acceptByProperties([{ qualifier: 'anything', level: 'err' }]), 'level')
    okay(!acceptor.acceptByProperties([{ qualifier: 'anything', level: 'info' }]), 'level fail')
    okay(!acceptor.acceptByProperties([{ qualifier: 'example.equals'}]), 'equals missing')
    okay(!acceptor.acceptByProperties([{ qualifier: 'example.equals', tag: 'receive' }]), 'equals unequal')
    okay(!acceptor.acceptByProperties([{ qualifier: 'example.equals', tag: [ 'receive' ] }]), 'equals not in array')
    okay(acceptor.acceptByProperties([{
        qualifier: 'example.equals', tag: [ 'send' ], level: 'warn'
    }, {
        key: 'value'
    }]), {
        path: '.example.equals.',
        level: 4,
        formatted: [],
        json: {
            qualifier: 'example.equals',
            tag: [ 'send' ],
            level: 'warn',
            key: 'value'
        }
    }, 'equals equal')
    okay(acceptor.acceptByProperties([{ qualifier: 'example.equals', level: 'debug', tag: [ 'send' ] }]), 'equals in array')
    okay(!acceptor.acceptByProperties([{ qualifier: 'example.regex', level: 'debug'  }]), 'regex missing')
    okay(!acceptor.acceptByProperties([{ qualifier: 'example.regex', level: 'debug', tag: 'b' }]), 'regex fail')
    okay(!acceptor.acceptByProperties([{ qualifier: 'example.regex', level: 'debug', tag: [ 'b' ] }]), 'regex array fail')
    okay(acceptor.acceptByProperties([{ qualifier: 'example.regex', level: 'debug', value: 'baz' }]), 'regex match')
    okay(acceptor.acceptByProperties([{ qualifier: 'example.regex', level: 'debug', value: 'baz' }]), 'regex match array')
    okay(acceptor.acceptByProperties([{ qualifier: 'example.and', level: 'debug', id: 'a', tag: [ 'user', 'send' ] }]), 'and')
    okay(acceptor.acceptByContext({ path: '.example.equals.', level: 7, json: { tag: [ 'send' ] } }), 'by context')
    okay(!acceptor.acceptByProperties([{ qualifier: 'example.and', level: 'debug', nope: 1 }]), 'nope')
}
<commit_msg>Test frist test of user function returning true.<commit_after>require('proof')(18, prove)

// Limited language that is ment to match specific entries in addition to
// winnowing by package and level. Select first by package name, then winnow by
// level or specifically by values in payload. Equality is coercive. Relative
// comparisons convert to numbers.
function prove (okay) {
    var Acceptor = require('..'), acceptor
    acceptor = new Acceptor(false, [])
    okay(!acceptor.acceptByProperties([{ qualifier: 'example', level: 'debug' }]), 'default drop')
    acceptor = new Acceptor(true, [])
    okay(!! acceptor.acceptByProperties([{ qualifier: 'example', level: 'debug' }]), 'default accept')
    acceptor = new Acceptor(false, [{
        path: '.',
        level: 'warn',
        accept: true
    }, {
        path: '.example.timer',
        level: 'debug',
        accept: true
    }, {
        path: '.example.equals',
        test: '$.tag && $.tag.indexOf &&  ~$.tag.indexOf("send")',
        accept: true
    }, {
        path: '.example.equals',
        test: '$.id == 1',
        accept: true
    }, {
        path: '.example.regex',
        test: '/a/.test($.value)',
        accept: true
    }, {
        path: '.example.and',
        test: '/a/.test($.id) && ~($.tag || []).indexOf("send")',
        accept: true
    }, {
        path: '.',
        test: '$.nope',
        accept: false
    }])
    okay(acceptor.acceptByProperties([{ qualifier: 'anything', level: 'err' }]), 'level')
    okay(!acceptor.acceptByProperties([{ qualifier: 'anything', level: 'info' }]), 'level fail')
    okay(!acceptor.acceptByProperties([{ qualifier: 'example.equals'}]), 'equals missing')
    okay(!acceptor.acceptByProperties([{ qualifier: 'example.equals', tag: 'receive' }]), 'equals unequal')
    okay(!acceptor.acceptByProperties([{ qualifier: 'example.equals', tag: [ 'receive' ] }]), 'equals not in array')
    okay(acceptor.acceptByProperties([{
        qualifier: 'example.equals', tag: [ 'send' ], level: 'warn'
    }, {
        key: 'value'
    }]), {
        path: '.example.equals.',
        level: 4,
        formatted: [],
        json: {
            qualifier: 'example.equals',
            tag: [ 'send' ],
            level: 'warn',
            key: 'value'
        }
    }, 'equals equal')
    okay(acceptor.acceptByProperties([{ qualifier: 'example.equals', level: 'debug', tag: [ 'send' ] }]), 'equals in array')
    okay(!acceptor.acceptByProperties([{ qualifier: 'example.regex', level: 'debug'  }]), 'regex missing')
    okay(!acceptor.acceptByProperties([{ qualifier: 'example.regex', level: 'debug', tag: 'b' }]), 'regex fail')
    okay(!acceptor.acceptByProperties([{ qualifier: 'example.regex', level: 'debug', tag: [ 'b' ] }]), 'regex array fail')
    okay(acceptor.acceptByProperties([{ qualifier: 'example.regex', level: 'debug', value: 'baz' }]), 'regex match')
    okay(acceptor.acceptByProperties([{ qualifier: 'example.regex', level: 'debug', value: 'baz' }]), 'regex match array')
    okay(acceptor.acceptByProperties([{ qualifier: 'example.and', level: 'debug', id: 'a', tag: [ 'user', 'send' ] }]), 'and')
    okay(acceptor.acceptByContext({ path: '.example.equals.', level: 7, json: { tag: [ 'send' ] } }), 'by context')
    // The following test the branches of the initial test against a user
    // function.
    okay(!acceptor.acceptByProperties([{ qualifier: 'example.and', level: 'debug', nope: 1 }]), 'match first test and drop')
    acceptor = new Acceptor(false, [{
        path: '.',
        test: 'true',
        accept: true
    }])
    okay(acceptor.acceptByProperties([{ qualifier: 'example.and', level: 'debug' }]), 'match first test and accept')
}
<|endoftext|>


<commit_before>var path = require('path')

var webpack = require('webpack')
var HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = function(options) {
  var plugins = []
  var loaders = []

  var production = process.env['NODE_ENV'] === 'production'
  var src = options.sourceDirectory || 'src'
  var main = options.mainFile || require('fs').existsSync(path.join(options.sourceDirectory || 'src', 'index.js')) ? path.join(options.sourceDirectory || 'src', 'index.js') : path.join(__dirname, 'sample','index.js')
  console.log('Using ' + main + ' as an entry script')
  var index = options.indexFile || require('fs').existsSync(path.join(process.cwd(), 'index.html')) ?
    path.join(process.cwd(), 'index.html') : path.join(__dirname, 'sample', 'index.html')
  console.log('Using ' + index + ' as an index file')

  var entry = path.resolve(process.cwd(), main)
  if (!production) {
    entry = [
        "webpack-dev-server/client?http://localhost:3000", // Needed for hot reloading
        "webpack/hot/only-dev-server", // See above
        entry
      ]
  }
  if (!production) {
    plugins.push(new webpack.HotModuleReplacementPlugin())
    plugins.push(new HtmlWebpackPlugin({template: index, inject: true}))
  }
if (production) {
  plugins.push(new HtmlWebpackPlugin({
    template: index,
    minify: {
      removeComments: true,
      collapseWhitespace: true,
      removeRedundantAttributes: true,
      useShortDoctype: true,
      removeEmptyAttributes: true,
      removeStyleLinkTypeAttributes: true,
      keepClosingSlash: true,
      minifyJS: true,
      minifyCSS: true,
      minifyURLs: true
    },
    inject: true
  }))
}
plugins.push(new webpack.DefinePlugin({"REACTUATE_DIRNAME": production ? "undefined" : JSON.stringify(__dirname)}))
if (production) {
  plugins.push(new webpack.optimize.UglifyJsPlugin({sourceMap: false, compress: {warnings: false}}))
}
plugins.push(new webpack.DefinePlugin({
  "process.env": {
    NODE_ENV: JSON.stringify(process.env.NODE_ENV || "development")
  }
}))
var jsLoaders = []
  jsLoaders.push('babel-loader?{presets:["react","es2015","stage-0"],plugins:["transform-export-extensions"],env:{development:{presets:["react-hmre"]}, production: {plugins:["transform-react-remove-prop-types","transform-react-constant-elements","transform-react-inline-elements"]}}}')
  loaders.push({test: /\.(js|jsx)$/,
    loaders: jsLoaders,
    exclude: /node_modules\/(?!reactuate)/
  })
  var devtool = process.env.NODE_ENV === 'production' ? undefined : 'cheap-module-inline-source-map'
  loaders.push({ test: /\.json$/, loader: 'json'})
  loaders.push({ test: /\.css$/, loader: 'style!css!postcss'})
  loaders.push({ test: /\.less$/, loader: 'style!css!less'})
  loaders.push({ test: /\.woff(2)?(\?.+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" })
  loaders.push({ test: /\.ttf(\?.+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream" })
  loaders.push({ test: /\.eot(\?.+)?$/, loader: "file" },
   { test: /\.svg(\?.+)?$/, loader: "url?limit=10000&mimetype=image/svg+xml" })
  loaders.push({ test: /\.png$/, loader: "url-loader?limit=100000" })
  loaders.push({ test: /\.jpg$/, loader: "file-loader" })

  return {
    entry: entry,
    devtool: devtool,
    plugins: plugins,
    postcss: function() {
      return [
      require('postcss-import')({
        resolve: function(id, base) {
            return require('globby').sync(path.join(base, id))
        },
        onImport: function (files) {
             files.forEach(this.addDependency)
         }.bind(this)
      }) ]
    },
    output: {
      path: path.resolve(process.cwd(), 'build'),
      publicPath: '/',
      filename: 'js/bundle.js'
    },
    module: {loaders: loaders},
    target: "web", // Make web variables accessible to webpack, e.g. window
    stats: false, // Don't show stats in the console
    progress: true
  }
}
<commit_msg>Added port to webpack-config, too<commit_after>var path = require('path')

var webpack = require('webpack')
var HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = function(options) {
  var plugins = []
  var loaders = []

  var production = process.env['NODE_ENV'] === 'production'
  var src = options.sourceDirectory || 'src'
  var main = options.mainFile || require('fs').existsSync(path.join(options.sourceDirectory || 'src', 'index.js')) ? path.join(options.sourceDirectory || 'src', 'index.js') : path.join(__dirname, 'sample','index.js')
  console.log('Using ' + main + ' as an entry script')
  var index = options.indexFile || require('fs').existsSync(path.join(process.cwd(), 'index.html')) ?
    path.join(process.cwd(), 'index.html') : path.join(__dirname, 'sample', 'index.html')
  console.log('Using ' + index + ' as an index file')

  var port = (process.env.PORT ? parseInt(process.env.PORT, 10) : 3000)
  var entry = path.resolve(process.cwd(), main)
  if (!production) {
    entry = [
        "webpack-dev-server/client?http://localhost:" + port, // Needed for hot reloading
        "webpack/hot/only-dev-server", // See above
        entry
      ]
  }
  if (!production) {
    plugins.push(new webpack.HotModuleReplacementPlugin())
    plugins.push(new HtmlWebpackPlugin({template: index, inject: true}))
  }
if (production) {
  plugins.push(new HtmlWebpackPlugin({
    template: index,
    minify: {
      removeComments: true,
      collapseWhitespace: true,
      removeRedundantAttributes: true,
      useShortDoctype: true,
      removeEmptyAttributes: true,
      removeStyleLinkTypeAttributes: true,
      keepClosingSlash: true,
      minifyJS: true,
      minifyCSS: true,
      minifyURLs: true
    },
    inject: true
  }))
}
plugins.push(new webpack.DefinePlugin({"REACTUATE_DIRNAME": production ? "undefined" : JSON.stringify(__dirname)}))
if (production) {
  plugins.push(new webpack.optimize.UglifyJsPlugin({sourceMap: false, compress: {warnings: false}}))
}
plugins.push(new webpack.DefinePlugin({
  "process.env": {
    NODE_ENV: JSON.stringify(process.env.NODE_ENV || "development")
  }
}))
var jsLoaders = []
  jsLoaders.push('babel-loader?{presets:["react","es2015","stage-0"],plugins:["transform-export-extensions"],env:{development:{presets:["react-hmre"]}, production: {plugins:["transform-react-remove-prop-types","transform-react-constant-elements","transform-react-inline-elements"]}}}')
  loaders.push({test: /\.(js|jsx)$/,
    loaders: jsLoaders,
    exclude: /node_modules\/(?!reactuate)/
  })
  var devtool = process.env.NODE_ENV === 'production' ? undefined : 'cheap-module-inline-source-map'
  loaders.push({ test: /\.json$/, loader: 'json'})
  loaders.push({ test: /\.css$/, loader: 'style!css!postcss'})
  loaders.push({ test: /\.less$/, loader: 'style!css!less'})
  loaders.push({ test: /\.woff(2)?(\?.+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" })
  loaders.push({ test: /\.ttf(\?.+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream" })
  loaders.push({ test: /\.eot(\?.+)?$/, loader: "file" },
   { test: /\.svg(\?.+)?$/, loader: "url?limit=10000&mimetype=image/svg+xml" })
  loaders.push({ test: /\.png$/, loader: "url-loader?limit=100000" })
  loaders.push({ test: /\.jpg$/, loader: "file-loader" })

  return {
    entry: entry,
    devtool: devtool,
    plugins: plugins,
    postcss: function() {
      return [
      require('postcss-import')({
        resolve: function(id, base) {
            return require('globby').sync(path.join(base, id))
        },
        onImport: function (files) {
             files.forEach(this.addDependency)
         }.bind(this)
      }) ]
    },
    output: {
      path: path.resolve(process.cwd(), 'build'),
      publicPath: '/',
      filename: 'js/bundle.js'
    },
    module: {loaders: loaders},
    target: "web", // Make web variables accessible to webpack, e.g. window
    stats: false, // Don't show stats in the console
    progress: true
  }
}
<|endoftext|>


<commit_before>const path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const BundleTracker = require('webpack-bundle-tracker');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const webpack = require('webpack');

const DISTPATH = path.resolve(__dirname, 'src/assets/components');
const cssName = require('@fi/theme/dist/assets.json')['main.css'];
const apiEndpoint = JSON.stringify(process.env.API_ENDPOINT || 'http://localhost:8000/legacy');

module.exports = {
  context: path.resolve(__dirname, 'src/javascript_components'),
  entry: {
    richEditor: './richEditor.js',
    allPages: './allPages',
    locationSearchField: './locationSearchField.js',
    creationForms: './creationForms',
    dashboard: './dashboard',
    map: ['babel-polyfill', './map/index.js'],
    theme: '@fi/theme/dist/styles/' + cssName,
    mandatesField: './mandatesField',
    amountWidget: './amountWidget'
  },
  plugins: [
    new CleanWebpackPlugin([DISTPATH]),
    new BundleTracker({path: DISTPATH}),
    new ExtractTextPlugin('theme-[contenthash].css'),
    new webpack.DefinePlugin({'API_ENDPOINT': apiEndpoint}),
    new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
    new BundleAnalyzerPlugin({analyzerMode: 'static', openAnalyzer: false}),
  ],
  output: {
    libraryTarget: 'window',
    library: '[name]',
    filename: '[name]-[chunkhash].js',
    path: DISTPATH
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /(node_modules|bower_components)/,
        use: {
          loader: 'babel-loader?cacheDirectory=true',
          options: {
            presets: ['babel-preset-env', 'babel-preset-react'],
            plugins: ['react-hot-loader/babel']
          }
        }
      },
      {
        test: new RegExp('@fi/theme/dist/styles/' + cssName),
        use: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: 'css-loader'
        })
      },
      {
        test: /\.css$/,
        exclude: [/node_modules\/tinymce/, /node_modules\/@fi\/theme/],
        use: ['style-loader', 'css-loader']
      },
      {
        test: /\.(png|woff|woff2|eot|ttf|svg)$/,
        loader: 'file-loader',
        options: {
          name: 'files/[name]-[hash].[ext]',
        },
      },
    ]
  },
  target: 'web'
};
<commit_msg>try to fix fonts in tinymce<commit_after>const path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const BundleTracker = require('webpack-bundle-tracker');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const webpack = require('webpack');

const DISTPATH = path.resolve(__dirname, 'src/assets/components');
const cssName = require('@fi/theme/dist/assets.json')['main.css'];
const apiEndpoint = JSON.stringify(process.env.API_ENDPOINT || 'http://localhost:8000/legacy');

module.exports = {
  context: path.resolve(__dirname, 'src/javascript_components'),
  entry: {
    richEditor: './richEditor.js',
    allPages: './allPages',
    locationSearchField: './locationSearchField.js',
    creationForms: './creationForms',
    dashboard: './dashboard',
    map: ['babel-polyfill', './map/index.js'],
    theme: '@fi/theme/dist/styles/' + cssName,
    mandatesField: './mandatesField',
    amountWidget: './amountWidget'
  },
  plugins: [
    new CleanWebpackPlugin([DISTPATH]),
    new BundleTracker({path: DISTPATH}),
    new ExtractTextPlugin('theme-[contenthash].css'),
    new webpack.DefinePlugin({'API_ENDPOINT': apiEndpoint}),
    new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
    new BundleAnalyzerPlugin({analyzerMode: 'static', openAnalyzer: false}),
  ],
  output: {
    libraryTarget: 'window',
    library: '[name]',
    filename: '[name]-[chunkhash].js',
    path: DISTPATH
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /(node_modules|bower_components)/,
        use: {
          loader: 'babel-loader?cacheDirectory=true',
          options: {
            presets: ['babel-preset-env', 'babel-preset-react'],
            plugins: ['react-hot-loader/babel']
          }
        }
      },
      {
        test: new RegExp('@fi/theme/dist/styles/' + cssName),
        use: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: 'css-loader'
        })
      },
      {
        test: /\.css$/,
        exclude: [/node_modules\/tinymce/, /node_modules\/@fi\/theme/],
        use: ['style-loader', 'css-loader']
      },
      {
        test: /\.(png|woff|woff2|eot|ttf|svg)$/,
        exclude: [/node_modules\/tinymce/],
        loader: 'file-loader',
        options: {
          name: 'files/[name]-[hash].[ext]',
        },
      },
    ]
  },
  target: 'web'
};
<|endoftext|>


<commit_before>const path = require("path");

module.exports = {
    entry: {
        home:        path.resolve(__dirname, "src/main/resources/public/jsx/home.js"),
        institution: path.resolve(__dirname, "src/main/resources/public/jsx/institution.js"),
        collection:  path.resolve(__dirname, "src/main/resources/public/jsx/collection.js"),
        project:     path.resolve(__dirname, "src/main/resources/public/jsx/project.js"),
        account:     path.resolve(__dirname, "src/main/resources/public/jsx/account.js"),
        geodashreact:     path.resolve(__dirname, "src/main/resources/public/jsx/geodashreact.js"),
        widgetlayouteditor:     path.resolve(__dirname, "src/main/resources/public/jsx/geo-dash-widget-editor.js")
    },
    output: {
        path: path.resolve(__dirname, "src/main/resources/public/js"),
        filename: "[name].bundle.js",
        library: "[name]",
        libraryTarget: "var"
    },
    module: {
        rules: [
            {
                test: /\.jsx?$/,
                exclude: /node_modules/,
                use: {
                    loader: "babel-loader",
                    options: {
                        presets: [
                            "@babel/preset-env",
                            "@babel/preset-react"
                        ],
                        plugins: [
                            "@babel/plugin-proposal-class-properties",
                            'lodash'
                        ]
                    }
                },
            },
            {
                test: /\.css$/,
                use: [
                    "style-loader",
                    "css-loader"
                ]
            },
            {
                test: /\.(png|svg|jpg|gif)$/,
                use: [
                    "file-loader"
                ]
            },
            {
                test: /\.(woff|woff2|eot|ttf|otf)$/,
                use: [
                    "file-loader"
                ]
            }
        ]
    },
    optimization: {
        splitChunks: {
            chunks: "all"
        }
    }
};
<commit_msg>Fixing formatting in webpack.common.js.<commit_after>const path = require("path");

module.exports = {
    entry: {
        home:               path.resolve(__dirname, "src/main/resources/public/jsx/home.js"),
        institution:        path.resolve(__dirname, "src/main/resources/public/jsx/institution.js"),
        collection:         path.resolve(__dirname, "src/main/resources/public/jsx/collection.js"),
        project:            path.resolve(__dirname, "src/main/resources/public/jsx/project.js"),
        account:            path.resolve(__dirname, "src/main/resources/public/jsx/account.js"),
        geodashreact:       path.resolve(__dirname, "src/main/resources/public/jsx/geodashreact.js"),
        widgetlayouteditor: path.resolve(__dirname, "src/main/resources/public/jsx/geo-dash-widget-editor.js")
    },
    output: {
        path: path.resolve(__dirname, "src/main/resources/public/js"),
        filename: "[name].bundle.js",
        library: "[name]",
        libraryTarget: "var"
    },
    module: {
        rules: [
            {
                test: /\.jsx?$/,
                exclude: /node_modules/,
                use: {
                    loader: "babel-loader",
                    options: {
                        presets: [
                            "@babel/preset-env",
                            "@babel/preset-react"
                        ],
                        plugins: [
                            "@babel/plugin-proposal-class-properties",
                            'lodash'
                        ]
                    }
                },
            },
            {
                test: /\.css$/,
                use: [
                    "style-loader",
                    "css-loader"
                ]
            },
            {
                test: /\.(png|svg|jpg|gif)$/,
                use: [
                    "file-loader"
                ]
            },
            {
                test: /\.(woff|woff2|eot|ttf|otf)$/,
                use: [
                    "file-loader"
                ]
            }
        ]
    },
    optimization: {
        splitChunks: {
            chunks: "all"
        }
    }
};
<|endoftext|>


<commit_before>const path = require('path');

const PATHS = {
  app: path.join(__dirname, "app"),
  dist: path.join(__dirname, "dist")
};

module.exports = {
  entry: {
    javascript: ["babel-polyfill", path.resolve(PATHS.app, "scripts", "main.js")],
    html: path.resolve(PATHS.app, "index.html"),
    css: path.resolve(PATHS.app, "styles", "main.css")
  },

  output: {
    path: PATHS.dist,
    filename: "./assets/scripts/bundle.js"
  },

  resolve: {
    extensions: ['', '.js', '.jsx', '.json'],
    root: path.join(PATHS.app, "scripts")
  },

  module: {
    loaders: [
      {
        test: /\.jsx?$/,
        loaders: ["babel-loader"],
        exclude: /node_modules/,
        include: PATHS.app
      },
      {
        test: /\.css$/,
        loaders: ["css"],
        exclude: /node_modules/,
        include: PATHS.app
      },
      {
        test: /\.html$/,
        loader: "file?name=[name].[ext]",
        exclude: /node_modules/,
        include: PATHS.app
      }
    ]
  }
};
<commit_msg>Use single quotes<commit_after>const path = require('path');

const PATHS = {
  app: path.join(__dirname, 'app'),
  dist: path.join(__dirname, 'dist')
};

module.exports = {
  entry: {
    main: ['babel-polyfill', path.resolve(PATHS.app, 'scripts', 'main.js')],
    html: path.resolve(PATHS.app, 'index.html'),
    css: path.resolve(PATHS.app, 'styles', 'main.css')
  },

  output: {
    path: PATHS.dist,
    filename: './assets/scripts/bundle.js'
  },

  resolve: {
    extensions: ['', '.js', '.jsx', '.json'],
    root: path.join(PATHS.app, 'scripts')
  },

  module: {
    loaders: [
      {
        test: /\.jsx?$/,
        loaders: ['babel-loader'],
        exclude: /node_modules/,
        include: PATHS.app
      },
      {
        test: /\.css$/,
        loaders: ['css'],
        exclude: /node_modules/,
        include: PATHS.app
      },
      {
        test: /\.html$/,
        loader: 'file?name=[name].[ext]',
        exclude: /node_modules/,
        include: PATHS.app
      }
    ]
  }
};
<|endoftext|>


<commit_before>/*eslint-disable no-var*/
var getConfig = require("hjs-webpack");
var config = require("./presentation/config");

var webpackConfig = getConfig({
  in: "./index.jsx",
  out: "dist",
  clearBeforeBuild: true,
  html: config.html
});

webpackConfig.module.loaders[0] = {
  test: /(\.js$)|(\.jsx$)/,
  exclude: /node_modules/,
  loaders: [
    "babel-loader?stage=1"
  ]
};

if (process.argv[1].indexOf("webpack-dev-server") !== -1) {
  webpackConfig.module.loaders[0].loaders.unshift("react-hot");
}

module.exports = webpackConfig;
<commit_msg>Set absolute url for assets.<commit_after>/*eslint-disable no-var*/
var getConfig = require("hjs-webpack");
var config = require("./presentation/config");

var webpackConfig = getConfig({
  in: "./index.jsx",
  out: "dist",
  output: {
    publicPath:'http://codemade.js.org/wmks-flux/'
  },
  clearBeforeBuild: true,
  html: config.html
});

webpackConfig.module.loaders[0] = {
  test: /(\.js$)|(\.jsx$)/,
  exclude: /node_modules/,
  loaders: [
    "babel-loader?stage=1"
  ]
};

if (process.argv[1].indexOf("webpack-dev-server") !== -1) {
  webpackConfig.module.loaders[0].loaders.unshift("react-hot");
}

module.exports = webpackConfig;
<|endoftext|>


<commit_before>const
  webpack = require('webpack'),
  version = require('./package.json').version;

module.exports = {
  name: 'browser',
  mode: 'production',
  entry: './index.js',
  output: {
    path: `${__dirname}/dist`,
    filename: 'kuzzle.js',
    library: 'kuzzle-sdk',
    libraryTarget: 'umd'
  },
  target: 'web',
  watch: false,
  devtool: 'source-map',
  node: false,
  module: {
    rules: [
      {
        test: /\.?js$/,
        use: {
          loader: 'babel-loader'
        }
      },
      {
        test: /\.?js$/,
        exclude: /node_modules/,
        loader: 'eslint-loader'
      }
    ]
  },
  plugins: [
    new webpack.IgnorePlugin(/^(http|min-req-promise|package|ws)$/),
    new webpack.DefinePlugin({
      SDKVERSION: JSON.stringify(version),
      BUILT: true
    }),
    new webpack.BannerPlugin('Kuzzle javascript SDK version ' + version),
    new webpack.optimize.OccurrenceOrderPlugin()
  ]
};
<commit_msg>Update webpack.config.js<commit_after>const
  webpack = require('webpack'),
  version = require('./package.json').version;

module.exports = {
  name: 'browser',
  mode: 'production',
  entry: './index.js',
  output: {
    path: `${__dirname}/dist`,
    filename: 'kuzzle.js',
    library: {
      root: 'KuzzleSDK',
      amd: 'kuzzle-sdk',
      commonjs: 'kuzzle-sdk'
    }
    libraryTarget: 'umd'
  },
  target: 'web',
  watch: false,
  devtool: 'source-map',
  node: false,
  module: {
    rules: [
      {
        test: /\.?js$/,
        use: {
          loader: 'babel-loader'
        }
      },
      {
        test: /\.?js$/,
        exclude: /node_modules/,
        loader: 'eslint-loader'
      }
    ]
  },
  plugins: [
    new webpack.IgnorePlugin(/^(http|min-req-promise|package|ws)$/),
    new webpack.DefinePlugin({
      SDKVERSION: JSON.stringify(version),
      BUILT: true
    }),
    new webpack.BannerPlugin('Kuzzle javascript SDK version ' + version),
    new webpack.optimize.OccurrenceOrderPlugin()
  ]
};
<|endoftext|>


<commit_before>'use strict';

const NODE_ENV = process.env.NODE_ENV || 'development';
const webpack = require('webpack');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const autoprefixer = require('autoprefixer');

module.exports = {
    context: __dirname + '/client',
    entry: './app.js',
    output: {
        path: __dirname + '/public',
        filename: 'build.js',
        // library: 'app',
    },

    watch: NODE_ENV === 'development',

    devtool: NODE_ENV === 'development' ? 'source-map': null,

    plugins: [
        new webpack.DefinePlugin({
            NODE_ENV: JSON.stringify(NODE_ENV)
        }),
        new webpack.NoErrorsPlugin(),
        new ExtractTextPlugin("[name].css")
    ],

    module: {
        loaders: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                loader: 'babel?presets[]=es2015,plugins[]=transform-es2015-modules-commonjs,plugins[]=transform-runtime'
            },
            {
                test: /\.less$/,
                loader: ExtractTextPlugin.extract('style','css!postcss!less')
            },
            {
              test: /\.(png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot)$/,
              loader: 'file?name=[path][name].[ext]'
            },

        ]
    },
    postcss: function() {
        return [autoprefixer({ browsers: ['last 2 versions'] })];
    }
};

if (NODE_ENV === 'production') {
    module.exports.plugins.push(
        new webpack.optimize.UglifyJsPlugin({
            compress: {
                warnings: false,
                drop_console: true,
                unsafe: true
            }
        })
    );
}<commit_msg>Added css minification<commit_after>'use strict';

const NODE_ENV = process.env.NODE_ENV || 'development';
const webpack = require('webpack');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const autoprefixer = require('autoprefixer');

module.exports = {
    context: __dirname + '/client',
    entry: './app.js',
    output: {
        path: __dirname + '/public',
        filename: 'build.js',
        // library: 'app',
    },

    watch: NODE_ENV === 'development',

    devtool: NODE_ENV === 'development' ? 'source-map': null,

    plugins: [
        new webpack.DefinePlugin({
            NODE_ENV: JSON.stringify(NODE_ENV)
        }),
        new webpack.NoErrorsPlugin(),
        new ExtractTextPlugin("[name].css")
    ],

    module: {
        loaders: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                loader: 'babel?presets[]=es2015,plugins[]=transform-es2015-modules-commonjs,plugins[]=transform-runtime'
            },
            {
                test: /\.less$/,
                loader: ExtractTextPlugin.extract('style','css?minimize!postcss!less')
            },
            {
              test: /\.(png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot)$/,
              loader: 'file?name=[path][name].[ext]'
            },

        ]
    },
    postcss: function() {
        return [autoprefixer({ browsers: ['last 2 versions'] })];
    }
};

if (NODE_ENV === 'production') {
    module.exports.plugins.push(
        new webpack.optimize.UglifyJsPlugin({
            compress: {
                warnings: false,
                drop_console: true,
                unsafe: true
            }
        })
    );
}<|endoftext|>


<commit_before>/* eslint-env node */

const autoprefixer = require('autoprefixer');
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;

module.exports = {
  context: `${__dirname}/app`,
  entry: {
    hglib: ['./scripts/hglib.js'],
    worker: ['./scripts/worker.js'],
  },
  watch: process.env.NODE_ENV === 'production' ? false : true,
  watchOptions: {
    aggregateTimeout: 300,
    poll: 1000,
    ignored: /node_modules/,
  },
  devServer: {
    contentBase: [
      path.resolve(__dirname, ''),
      path.resolve(__dirname, 'app'),
    ]
  },
  devtool: 'cheap-source-map',
  devServer: {
    contentBase: [
      path.resolve(__dirname, "app"),
      path.resolve(__dirname, "node_modules"),
    ],
    publicPath: "/"
  },
  output: {
    path: `${__dirname}/build`,
    publicPath: '/',
    filename: '[name].js',
    libraryTarget: 'umd',
    library: '[name]',
  },
  module: {
    loaders: [
      {
        test: /\.jsx?$/,
        include: [
          path.resolve(__dirname, 'app/scripts'),
          path.resolve(__dirname, 'test'),
        ],
        use: [
          {
            loader: 'babel-loader',
            options: {
              plugins: [
                [
                  'react-css-modules',
                  {
                    context: path.resolve(__dirname, 'app'),
                    filetypes: {
                      '.scss': {
                        syntax: 'postcss-scss',
                      },
                    },
                    generateScopedName: '[name]_[local]-[hash:base64:5]',
                  },
                ],
              ],
            },
          },
        ],
      },
      {
        test: /^((?!\.module).)*s?css$/,
        use: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: [
            {
              loader: 'css-loader',
              options: {
                importLoaders: 2,
                minimize: process.env.NODE_ENV === 'development' ? false : { presets: 'default' },
                sourceMap: process.env.NODE_ENV !== 'development',
              },
            },
            {
              loader: 'postcss-loader',
              options: {
                // Necessary for external CSS imports to work
                // https://github.com/facebookincubator/create-react-app/issues/2677
                ident: 'postcss',
                plugins: () => [
                  require('postcss-flexbugs-fixes'),
                  autoprefixer({
                    browsers: [
                      '>1%',
                      'last 4 versions',
                      'Firefox ESR',
                      'not ie < 9', // React doesn't support IE8 anyway
                    ],
                    flexbox: 'no-2009',
                  }),
                ],
                sourceMap: process.env.NODE_ENV !== 'development',
              },
            },
            {
              loader: 'sass-loader',
              options: {
                sourceMap: process.env.NODE_ENV !== 'development',
              },
            },
          ],
        }),
      },
      {
        test: /\.module.s?css$/,
        use: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: [
            {
              loader: 'css-loader',
              options: {
                importLoaders: 2,
                localIdentName: '[name]_[local]-[hash:base64:5]',
                minimize: process.env.NODE_ENV === 'development' ? false : { presets: 'default' },
                modules: true,
                sourceMap: process.env.NODE_ENV !== 'development',
              },
            },
            {
              loader: 'postcss-loader',
              options: {
                // Necessary for external CSS imports to work
                // https://github.com/facebookincubator/create-react-app/issues/2677
                ident: 'postcss',
                plugins: () => [
                  require('postcss-flexbugs-fixes'),
                  autoprefixer({
                    browsers: [
                      '>1%',
                      'last 4 versions',
                      'Firefox ESR',
                      'not ie < 9', // React doesn't support IE8 anyway
                    ],
                    flexbox: 'no-2009',
                  }),
                ],
                sourceMap: process.env.NODE_ENV !== 'development',
              },
            },
            {
              loader: 'sass-loader',
              options: {
                sourceMap: process.env.NODE_ENV !== 'development',
              },
            },
          ],
        }),
      },
    ],
    noParse: [
      /node_modules\/sinon\//,
    ],
  },
  externals: {
    'pixi.js': {
      commonjs: 'pixi.js',
      commonjs2: 'pixi.js',
      amd: 'pixi.js',
      root: 'PIXI',
    },
    react: {
      commonjs: 'react',
      commonjs2: 'react',
      amd: 'react',
      root: 'React',
    },
    'react-dom': {
      commonjs: 'react-dom',
      commonjs2: 'react-dom',
      amd: 'react-dom',
      root: 'ReactDOM',
    },
    'react-bootstrap': {
      commonjs: 'react-bootstrap',
      commonjs2: 'react-bootstrap',
      amd: 'react-bootstrap',
      root: 'ReactBootstrap',
    },
  },
  plugins: [
    new webpack.DefinePlugin({
      'process.env': {
      'NODE_ENV': JSON.stringify('production')
      }
    }),
    new webpack.IgnorePlugin(/react\/addons/),
    new webpack.IgnorePlugin(/react\/lib\/ReactContext/),
    new webpack.IgnorePlugin(/react\/lib\/ExecutionEnvironment/),
    new ExtractTextPlugin('hglib.css'),
    new webpack.optimize.ModuleConcatenationPlugin(),
    // new BundleAnalyzerPlugin(),
  ],
};
<commit_msg>Remove duplication<commit_after>/* eslint-env node */

const autoprefixer = require('autoprefixer');
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;

module.exports = {
  context: `${__dirname}/app`,
  entry: {
    hglib: ['./scripts/hglib.js'],
    worker: ['./scripts/worker.js'],
  },
  watch: process.env.NODE_ENV === 'production' ? false : true,
  watchOptions: {
    aggregateTimeout: 300,
    poll: 1000,
    ignored: /node_modules/,
  },
  devtool: 'cheap-source-map',
  devServer: {
    contentBase: [
      path.resolve(__dirname, 'app'),
      path.resolve(__dirname, 'node_modules'),
    ],
    publicPath: '/'
  },
  output: {
    path: `${__dirname}/build`,
    publicPath: '/',
    filename: '[name].js',
    libraryTarget: 'umd',
    library: '[name]',
  },
  module: {
    loaders: [
      {
        test: /\.jsx?$/,
        include: [
          path.resolve(__dirname, 'app/scripts'),
          path.resolve(__dirname, 'test'),
        ],
        use: [
          {
            loader: 'babel-loader',
            options: {
              plugins: [
                [
                  'react-css-modules',
                  {
                    context: path.resolve(__dirname, 'app'),
                    filetypes: {
                      '.scss': {
                        syntax: 'postcss-scss',
                      },
                    },
                    generateScopedName: '[name]_[local]-[hash:base64:5]',
                  },
                ],
              ],
            },
          },
        ],
      },
      {
        test: /^((?!\.module).)*s?css$/,
        use: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: [
            {
              loader: 'css-loader',
              options: {
                importLoaders: 2,
                minimize: process.env.NODE_ENV === 'development' ? false : { presets: 'default' },
                sourceMap: process.env.NODE_ENV !== 'development',
              },
            },
            {
              loader: 'postcss-loader',
              options: {
                // Necessary for external CSS imports to work
                // https://github.com/facebookincubator/create-react-app/issues/2677
                ident: 'postcss',
                plugins: () => [
                  require('postcss-flexbugs-fixes'),
                  autoprefixer({
                    browsers: [
                      '>1%',
                      'last 4 versions',
                      'Firefox ESR',
                      'not ie < 9', // React doesn't support IE8 anyway
                    ],
                    flexbox: 'no-2009',
                  }),
                ],
                sourceMap: process.env.NODE_ENV !== 'development',
              },
            },
            {
              loader: 'sass-loader',
              options: {
                sourceMap: process.env.NODE_ENV !== 'development',
              },
            },
          ],
        }),
      },
      {
        test: /\.module.s?css$/,
        use: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: [
            {
              loader: 'css-loader',
              options: {
                importLoaders: 2,
                localIdentName: '[name]_[local]-[hash:base64:5]',
                minimize: process.env.NODE_ENV === 'development' ? false : { presets: 'default' },
                modules: true,
                sourceMap: process.env.NODE_ENV !== 'development',
              },
            },
            {
              loader: 'postcss-loader',
              options: {
                // Necessary for external CSS imports to work
                // https://github.com/facebookincubator/create-react-app/issues/2677
                ident: 'postcss',
                plugins: () => [
                  require('postcss-flexbugs-fixes'),
                  autoprefixer({
                    browsers: [
                      '>1%',
                      'last 4 versions',
                      'Firefox ESR',
                      'not ie < 9', // React doesn't support IE8 anyway
                    ],
                    flexbox: 'no-2009',
                  }),
                ],
                sourceMap: process.env.NODE_ENV !== 'development',
              },
            },
            {
              loader: 'sass-loader',
              options: {
                sourceMap: process.env.NODE_ENV !== 'development',
              },
            },
          ],
        }),
      },
    ],
    noParse: [
      /node_modules\/sinon\//,
    ],
  },
  externals: {
    'pixi.js': {
      commonjs: 'pixi.js',
      commonjs2: 'pixi.js',
      amd: 'pixi.js',
      root: 'PIXI',
    },
    react: {
      commonjs: 'react',
      commonjs2: 'react',
      amd: 'react',
      root: 'React',
    },
    'react-dom': {
      commonjs: 'react-dom',
      commonjs2: 'react-dom',
      amd: 'react-dom',
      root: 'ReactDOM',
    },
    'react-bootstrap': {
      commonjs: 'react-bootstrap',
      commonjs2: 'react-bootstrap',
      amd: 'react-bootstrap',
      root: 'ReactBootstrap',
    },
  },
  plugins: [
    new webpack.DefinePlugin({
      'process.env': {
      'NODE_ENV': JSON.stringify('production')
      }
    }),
    new webpack.IgnorePlugin(/react\/addons/),
    new webpack.IgnorePlugin(/react\/lib\/ReactContext/),
    new webpack.IgnorePlugin(/react\/lib\/ExecutionEnvironment/),
    new ExtractTextPlugin('hglib.css'),
    new webpack.optimize.ModuleConcatenationPlugin(),
    // new BundleAnalyzerPlugin(),
  ],
};
<|endoftext|>


<commit_before>var path = require('path');

var paths = {
  src: path.join(__dirname, 'src'),
  dist: path.join(__dirname, 'dist'),
};

module.exports = {
  entry: paths.src + '/plugin.js',
  output: {
    path: paths.dist,
    filename: 'jquery.cropit.js',
    library: ['cropitlibrary'],
    libraryTarget: 'umd'
  },

  module: {
    loaders: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        loader: 'babel-loader?blacklist[]=strict',
      },
    ],
  },

  externals: { 'jquery': 'jQuery' },

  watch: true,
};
<commit_msg>Removed webpack watch from default<commit_after>var path = require('path');

var paths = {
  src: path.join(__dirname, 'src'),
  dist: path.join(__dirname, 'dist'),
};

module.exports = {
  entry: paths.src + '/plugin.js',
  output: {
    path: paths.dist,
    filename: 'jquery.cropit.js',
    library: ['cropitlibrary'],
    libraryTarget: 'umd'
  },

  module: {
    loaders: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        loader: 'babel-loader?blacklist[]=strict',
      },
    ],
  },

  externals: { 'jquery': 'jQuery' },
};
<|endoftext|>


<commit_before>var webpack = require('webpack')
var path = require('path')
var ExtractTextPlugin = require("extract-text-webpack-plugin")
var rucksack = require('rucksack-css')
var env = process.env.NODE_ENV || 'development';

module.exports = {
  context: path.join(__dirname, './src'),
  entry: {
    _html: './index.html',
    app: [
      './app',
    ],
    vendor: [
      'expose?jQuery!expose?$!jquery', 'lodash',
      'react', 'react-dom',
      'react-router', 'redux',
      'react-redux', 'react-router-redux',
      'redux-form', 'fetch-plus', 'redux-thunk',
      'react-validation-mixin', 'joi-validation-strategy',
      'bootstrap/dist/css/bootstrap.css', 'bootstrap/dist/js/bootstrap.min.js',
    ],
  },
  output: {
    path: path.join(__dirname, './build'),
    filename: 'js/app.js',
  },
  node: {
    net: 'empty',
    tls: 'empty',
    dns: 'empty'
  },
  module: {
    loaders: [
      { test: /\.html$/,
        loader: 'file?name=[name].[ext]' },
      { test: /\.(js|jsx)$/,
        exclude: /node_modules/,
        loaders: [ 'react-hot', 'babel' ] },
      { test: /\.(png|jpg|gif)$/,
        loader: 'file-loader?name=img/[name].[ext]' },
      { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
        loader: "url-loader?limit=100000&minetype=application/font-woff" },
      { test: /\.(ttf|eot)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
        loader: "file-loader?name=fonts/[name].[ext]" },
      { test: /\.svg(\?v=[0-9]\.[0-9]\.[0-9])?$/,
        loader: "file-loader?name=svg/[name].[ext]" },
      { test: /\.(scss|css)$/, // Only .less files
        loader: ExtractTextPlugin.extract([ 'css', 'sass', 'postcss' ]) }
    ],
  },
  resolve: {
    extensions: ['', '.js', '.jsx']
  },
  postcss: [
    rucksack({
      autoprefixer: true
    })
  ],
  plugins: [
    new webpack.optimize.CommonsChunkPlugin('vendor', './js/vendor.js'),
    new ExtractTextPlugin("css/[name].css"),
    (env == 'production' ? new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } }) : function(){}),
    new webpack.DefinePlugin({
      'process.env': { NODE_ENV: JSON.stringify(env) }
    })
  ],
  devServer: {
    contentBase: './build',
    hot: true,
    watchOptions: {
      aggregateTimeout: 300,
      poll: 100
    }
  }
}
<commit_msg>* style-loader works now<commit_after>var webpack = require('webpack')
var path = require('path')
var ExtractTextPlugin = require("extract-text-webpack-plugin")
var rucksack = require('rucksack-css')
var env = process.env.NODE_ENV || 'development';

module.exports = {
  context: path.join(__dirname, './src'),
  entry: {
    _html: './index.html',
    app: [
      './app',
    ],
    vendor: [
      'expose?jQuery!expose?$!jquery', 'lodash',
      'react', 'react-dom',
      'react-router', 'redux',
      'react-redux', 'react-router-redux',
      'redux-form', 'fetch-plus', 'redux-thunk',
      'react-validation-mixin', 'joi-validation-strategy',
      'bootstrap/dist/css/bootstrap.css', 'bootstrap/dist/js/bootstrap.min.js',
    ],
  },
  output: {
    path: path.join(__dirname, './build'),
    filename: 'js/app.js',
  },
  node: {
    net: 'empty',
    tls: 'empty',
    dns: 'empty'
  },
  module: {
    loaders: [
      { test: /\.html$/,
        loader: 'file?name=[name].[ext]' },
      { test: /\.(js|jsx)$/,
        exclude: /node_modules/,
        loaders: [ 'react-hot', 'babel' ] },
      { test: /\.(png|jpg|gif)$/,
        loader: 'file-loader?name=img/[name].[ext]' },
      { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
        loader: "url-loader?limit=100000&minetype=application/font-woff" },
      { test: /\.(ttf|eot)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
        loader: "file-loader?name=fonts/[name].[ext]" },
      { test: /\.svg(\?v=[0-9]\.[0-9]\.[0-9])?$/,
        loader: "file-loader?name=svg/[name].[ext]" },
      { test: /\.(scss|css)$/, // Only .less files
        loader: ExtractTextPlugin.extract('style-loader', 'css!sass!postcss') }
    ],
  },
  resolve: {
    extensions: ['', '.js', '.jsx']
  },
  postcss: [
    rucksack({
      autoprefixer: true
    })
  ],
  plugins: [
    new webpack.optimize.CommonsChunkPlugin('vendor', './js/vendor.js'),
    new ExtractTextPlugin("css/[name].css"),
    (env == 'production' ? new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } }) : function(){}),
    new webpack.DefinePlugin({
      'process.env': { NODE_ENV: JSON.stringify(env) }
    })
  ],
  devServer: {
    contentBase: './build',
    hot: true,
    watchOptions: {
      aggregateTimeout: 300,
      poll: 100
    }
  }
}
<|endoftext|>


<commit_before>const DojoWebpackPlugin = require("dojo-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");

const path = require("path");
const webpack = require("webpack");

module.exports = {
    entry: "src/JBrowse/main",
    plugins: [
        new DojoWebpackPlugin({
            loaderConfig: require("./build/dojo-loader-config"),
            environment: {
                dojoRoot: "../node_modules"
            },
            buildEnvironment: {
                dojoRoot: "node_modules"
            },
            locales: ["en"]
        }),

        //new DojoWebpackPlugin.ScopedRequirePlugin(),

        new CopyWebpackPlugin([{
            context: "node_modules",
            from: "dojo/resources/blank.gif",
            to: "dojo/resources"
        }]),

        new webpack.NormalModuleReplacementPlugin(
            /^dojox\/gfx\/renderer!/,
            "dojox/gfx/canvas"
        ),

        new webpack.NormalModuleReplacementPlugin(/^dojo\/text!/, function(data) {
            data.request = data.request.replace(/^dojo\/text!/, "!!raw-loader!");
        }),

        // new webpack.optimize.UglifyJsPlugin({minimize: true})
    ],
    module: {
        rules: [
            {
                test: path.resolve('src/JBrowse/main.js'),
                use: [{ loader: path.resolve('build/glob-loader.js') }]
            }
        ]
    },
    output: {
        filename: '[name].bundle.js',
        chunkFilename: '[name].bundle.js',
        path: path.resolve(__dirname, 'dist'),
        publicPath: 'dist/'
    },
    resolveLoader: {
        modules: ["node_modules"]
    },
    node: {
        process: false,
        global: false
    }
};
<commit_msg>add source maps to webpack conf for now<commit_after>const DojoWebpackPlugin = require("dojo-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");

const path = require("path");
const webpack = require("webpack");

module.exports = {
    entry: "src/JBrowse/main",
    devtool: 'eval-source-map',
    plugins: [
        new DojoWebpackPlugin({
            loaderConfig: require("./build/dojo-loader-config"),
            environment: {
                dojoRoot: "../node_modules"
            },
            buildEnvironment: {
                dojoRoot: "node_modules"
            },
            locales: ["en"]
        }),

        new CopyWebpackPlugin([{
            context: "node_modules",
            from: "dojo/resources/blank.gif",
            to: "dojo/resources"
        }]),

        new webpack.NormalModuleReplacementPlugin(
            /^dojox\/gfx\/renderer!/,
            "dojox/gfx/canvas"
        ),

        new webpack.NormalModuleReplacementPlugin(/^dojo\/text!/, function(data) {
            data.request = data.request.replace(/^dojo\/text!/, "!!raw-loader!");
        }),

        // new webpack.optimize.UglifyJsPlugin({minimize: true})
    ],
    module: {
        rules: [
            {
                test: path.resolve('src/JBrowse/main.js'),
                use: [{ loader: path.resolve('build/glob-loader.js') }]
            }
        ]
    },
    output: {
        filename: '[name].bundle.js',
        chunkFilename: '[name].bundle.js',
        path: path.resolve(__dirname, 'dist'),
        publicPath: 'dist/'
    },
    resolveLoader: {
        modules: ["node_modules"]
    },
    node: {
        process: false,
        global: false
    }
};
<|endoftext|>


<commit_before>var path = require('path');
var webpack = require('webpack');

var prodDefines = new webpack.DefinePlugin({
	"Imba.SERVER": false,
	"Imba.DEBUG": false,
	"Imba.CLIENT": true
})

var prod = [
	new webpack.DefinePlugin({
		"Imba.SERVER": false,
		"Imba.DEBUG": false,
		"Imba.CLIENT": true
	}),
	new webpack.optimize.UglifyJsPlugin({minimize: true})
]

var dev = [
	new webpack.DefinePlugin({
		"Imba.SERVER": false,
		"Imba.DEBUG": true,
		"Imba.CLIENT": true
	})
]

var resolveLoader = {
	// root: path.join(__dirname, "node_modules")
	alias: {
		"imba-loader": path.join(__dirname, "./loader"),
		"path": "path-browserify"
	}
}

module.exports = [{
	module: {loaders: [{ "test": /\.imba$/, "loader": 'imba-loader'}]},
	resolveLoader: resolveLoader,
	resolve: {extensions: ['', '.imba', '.js']},
	entry: "./src/imba/index.imba",
	output: { filename: "./dist/imba.dev.js" },
	plugins: dev
},{
	module: {loaders: [{ "test": /\.imba$/, "loader": 'imba-loader'}]},
	resolveLoader: resolveLoader,
	resolve: {extensions: ['', '.imba','.js']},
	entry: "./src/imba/index.imba",
	output: { filename: "./dist/imba.js" },
	plugins: [prodDefines]
},{
	module: {loaders: [{ "test": /\.imba$/, "loader": 'imba-loader'}]},
	resolveLoader: resolveLoader,
	resolve: {extensions: ['', '.imba','.js']},
	entry: "./src/imba/index.imba",
	output: { filename: "./dist/imba.min.js" },
	plugins: prod
},{
	module: {loaders: [{ "test": /\.imba$/, "loader": 'imba-loader'}]},
	resolveLoader: resolveLoader,
	resolve: {extensions: ['', '.js', '.imba']},
	entry: "./src/compiler/compiler.imba",
	output: { filename: "./dist/imbac.dev.js", library: "Imbac" },
	target: 'web',
	node: {fs: "empty"},
	plugins: dev
},{
	module: {loaders: [{ "test": /\.imba$/, "loader": 'imba-loader'}]},
	resolveLoader: resolveLoader,
	resolve: {extensions: ['', '.js', '.imba']},
	entry: "./src/compiler/compiler.imba",
	output: { filename: "./dist/imbac.js", library: "Imbac" },
	target: 'web',
	node: {fs: "empty"},
	plugins: prod
},{
	module: {loaders: [{ "test": /\.imba$/, "loader": 'imba-loader'}]},
	resolveLoader: resolveLoader,
	resolve: {extensions: ['', '.js', '.imba']},
	entry: "./test/src/index.imba",
	output: { filename: "./test/client.js"},
	target: 'web',
	node: {fs: "empty"},
	plugins: dev
}]

<commit_msg>Fix path for webpack config<commit_after>var path = require('path');
var webpack = require('webpack');

var prodDefines = new webpack.DefinePlugin({
	"Imba.SERVER": false,
	"Imba.DEBUG": false,
	"Imba.CLIENT": true
})

var prod = [
	new webpack.DefinePlugin({
		"Imba.SERVER": false,
		"Imba.DEBUG": false,
		"Imba.CLIENT": true
	}),
	new webpack.optimize.UglifyJsPlugin({minimize: true})
]

var dev = [
	new webpack.DefinePlugin({
		"Imba.SERVER": false,
		"Imba.DEBUG": true,
		"Imba.CLIENT": true
	})
]

var resolveLoader = {
	// root: path.join(__dirname, "node_modules")
	alias: {
		"imba-loader": path.join(__dirname, "./loader"),
		"path": "path-browserify"
	}
}

module.exports = [{
	module: {loaders: [{ "test": /\.imba$/, "loader": 'imba-loader'}]},
	resolveLoader: resolveLoader,
	resolve: {extensions: ['', '.imba', '.js']},
	entry: "./src/imba/index.imba",
	output: { filename: "./dist/imba.dev.js" },
	plugins: dev
},{
	module: {loaders: [{ "test": /\.imba$/, "loader": 'imba-loader'}]},
	resolveLoader: resolveLoader,
	resolve: {extensions: ['', '.imba','.js']},
	entry: "./src/imba/index.imba",
	output: { filename: "./dist/imba.js" },
	plugins: [prodDefines]
},{
	module: {loaders: [{ "test": /\.imba$/, "loader": 'imba-loader'}]},
	resolveLoader: resolveLoader,
	resolve: {extensions: ['', '.imba','.js']},
	entry: "./src/imba/index.imba",
	output: { filename: "./dist/imba.min.js" },
	plugins: prod
},{
	module: {loaders: [{ "test": /\.imba$/, "loader": 'imba-loader'}]},
	resolveLoader: resolveLoader,
	resolve: {extensions: ['', '.js', '.imba']},
	entry: "./src/compiler/compiler.imba",
	output: { filename: "./dist/imbac.dev.js", library: "Imbac" },
	target: 'web',
	node: {fs: "empty"},
	plugins: dev
},{
	module: {loaders: [{ "test": /\.imba$/, "loader": 'imba-loader'}]},
	resolveLoader: resolveLoader,
	resolve: {extensions: ['', '.js', '.imba']},
	entry: "./src/compiler/compiler.imba",
	output: { filename: "./dist/imbac.js", library: "Imbac" },
	target: 'web',
	node: {fs: "empty"},
	plugins: prod
},{
	module: {loaders: [{ "test": /\.imba$/, "loader": 'imba-loader'}]},
	resolveLoader: resolveLoader,
	resolve: {extensions: ['', '.js', '.imba']},
	entry: "./test/index.imba",
	output: { filename: "./test/client.js"},
	target: 'web',
	node: {fs: "empty"},
	plugins: dev
}]

<|endoftext|>


<commit_before>var webpack = require('webpack');
var path = require('path');

var CleanPlugin = require('clean-webpack-plugin');
var HtmlPlugin = require('html-webpack-plugin');

module.exports = {
  devtool: 'source-map',
  entry: {
    candela: './src/index.js',
    demo: './app/demo/index.js'
  },
  output: {
    library: '[name]',
    libraryTarget: 'umd',
    path: 'dist',
    filename: '[name]/[name].js'
  },
  resolve: {
    alias: {
      vega: path.resolve(__dirname, 'node_modules/vega/index.js'),
      d3: path.resolve(__dirname, 'node_modules/d3/d3.min.js')
    }
  },
  plugins: [
    new webpack.ProvidePlugin({
      vg: 'vega'
    }),

    new CleanPlugin([
      './dist'
    ]),

    new HtmlPlugin({
      title: 'Candela Demo',
      filename: 'demo/index.html',
      chunks: ['demo']
    })
  ],
  module: {
    preLoaders: [
      {
        test: /\.js$/,
        loader: 'semistandard',
        include: path.resolve(__dirname, 'src'),
        include: path.resolve(__dirname, 'app'),
        exclude: path.resolve(__dirname, 'src', 'external')
      }
    ],
    loaders: [
      {
        test: require.resolve('./src/index.js'),
        loader: 'expose?candela'
      },
      {
        test: /\.js$/,
        loader: 'babel-loader',
        query: {
          presets: ['es2015']
        },
        include: [
          __dirname + '/src',
          __dirname + '/app'
        ]
      },
      {
        test: function (path) {
          return path.endsWith('/src/external/pc.js');
        },
        loader: 'legacy'
      },
      {
        test: /\.styl$/,
        loaders: ['style', 'css', 'stylus']
      },
      {
        test: /\.jade$/,
        loaders: ['jade']
      },
      {
        test: /\.json$/,
        loader: 'json'
      }
    ]
  }
};
<commit_msg>Use build for build directory instead of dist<commit_after>var webpack = require('webpack');
var path = require('path');

var CleanPlugin = require('clean-webpack-plugin');
var HtmlPlugin = require('html-webpack-plugin');

module.exports = {
  devtool: 'source-map',
  entry: {
    candela: './src/index.js',
    demo: './app/demo/index.js'
  },
  output: {
    library: '[name]',
    libraryTarget: 'umd',
    path: 'build',
    filename: '[name]/[name].js'
  },
  resolve: {
    alias: {
      vega: path.resolve(__dirname, 'node_modules/vega/index.js'),
      d3: path.resolve(__dirname, 'node_modules/d3/d3.min.js')
    }
  },
  plugins: [
    new webpack.ProvidePlugin({
      vg: 'vega'
    }),

    new CleanPlugin([
      './build'
    ]),

    new HtmlPlugin({
      title: 'Candela Demo',
      filename: 'demo/index.html',
      chunks: ['demo']
    })
  ],
  module: {
    preLoaders: [
      {
        test: /\.js$/,
        loader: 'semistandard',
        include: path.resolve(__dirname, 'src'),
        include: path.resolve(__dirname, 'app'),
        exclude: path.resolve(__dirname, 'src', 'external')
      }
    ],
    loaders: [
      {
        test: require.resolve('./src/index.js'),
        loader: 'expose?candela'
      },
      {
        test: /\.js$/,
        loader: 'babel-loader',
        query: {
          presets: ['es2015']
        },
        include: [
          __dirname + '/src',
          __dirname + '/app'
        ]
      },
      {
        test: function (path) {
          return path.endsWith('/src/external/pc.js');
        },
        loader: 'legacy'
      },
      {
        test: /\.styl$/,
        loaders: ['style', 'css', 'stylus']
      },
      {
        test: /\.jade$/,
        loaders: ['jade']
      },
      {
        test: /\.json$/,
        loader: 'json'
      }
    ]
  }
};
<|endoftext|>


<commit_before>var path = require("path");
var open = require("open");
//for legac systems
require('es6-promise').polyfill();

//a little bit of glitch before page opens,
//works well otherwise
open("http://localhost:8080/");

module.exports = {
    entry: [
        //'webpack/hot/dev-server',
        'webpack-dev-server/client?http://localhost:8080',
        path.resolve(__dirname, 'app/js/main.js')
    ],
    output: {
        path: path.resolve(__dirname, './dist/js'),
        publicPath: 'js',
        filename: 'bundle.js'
    },
    debug: true,
    devtool: "#eval-source-map",
    module: {
        preLoaders: [
            {test: /\.js$/, loader: "eslint-loader",  exclude: /node_modules/ }
        ],
        loaders: [
            {test: /\.scss$/,loaders: ["style", "css", "autoprefixer-loader", "sass"]},
            {test: /\.jade/, loader: "jade" },
            {test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel',
                query: {
                    presets: ['es2015', 'react']
                }
            }
        ],
        postLoaders: [
          { loader: "transform?brfs" }
        ],
        resolve: {
            extensions: ['', '.js', '.jsx']
        }
    },
    eslint: {
        configFile: '.eslintrc'
    }
};
<commit_msg>added alias for react-canvas, sped up webpack compilation times.<commit_after>var path = require("path");
var open = require("open");
//for legac systems
require('es6-promise').polyfill();

//a little bit of glitch before page opens,
//works well otherwise
open("http://localhost:8080/");

module.exports = {

    entry: [
        //'webpack/hot/dev-server',
        'webpack-dev-server/client?http://localhost:8080',
        path.resolve(__dirname, 'app/js/main.js')
    ],
    output: {
        path: path.resolve(__dirname, './dist/js'),
        publicPath: 'js',
        filename: 'bundle.js'
    },
    debug: true,
    devtool: "#eval-source-map",
    module: {
        preLoaders: [
            {test: /\.js$/, loader: "eslint-loader",  exclude: /node_modules/ }
        ],
        //https://github.com/Flipboard/react-canvas/issues/102
        loaders: [
            {test: /\.scss$/,loaders: ["style", "css", "autoprefixer-loader", "sass"]},
            {test: /\.jade/, loader: "jade" },
            // { test: /\.js$/, loader: 'jsx-loader!transform/cacheable?envify' },
            {test: /\.js?$/, exclude: /node_modules/, loader: 'babel',
                query: {
                    presets: ['es2015', 'react']
                }
            }
        ],
        postLoaders: [
          { loader: "transform?brfs" }
        ],
        resolve: {
            extensions: ['', '.js', '.jsx'],
            alias: {
              'react-canvas': 'lib/ReactCanvas.js'
            }
        }
    },
    eslint: {
        configFile: '.eslintrc'
    }
};
<|endoftext|>


<commit_before>'use strict';

const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');

const extractCSS = new ExtractTextPlugin('bundle.css');

module.exports = {
  entry: ['./src/index.js', './style/scss/styles.scss'],
  output: {
    path: path.resolve(__dirname, "dist"),
    publicPath: '/dist/',
    filename: 'bundle.js'
  },
  module: {
    rules:[
      {
        test: /\.js$/,
        use: [{
          loader: 'babel-loader',
          options: {
            presets: ["react", "es2015", "stage-1"]
          }
        }]
      },
      {
        test: /\.scss$/,
        use: extractCSS.extract({
          use: [{
                loader: "css-loader"
              },{
                loader: "postcss-loader",
                options: {
                  plugins: (loader) => [
                    require('postcss-import')({ root: loader.resourcePath }),
                    require('postcss-cssnext')(),
                    require('cssnano')()
                  ]
                }
              },{
                loader: "sass-loader"
              }]
        })
      }
    ]
  },
  devServer: {
    historyApiFallback: true,
    contentBase: './'
  },
  plugins: [
    extractCSS,
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
      'env.host': process.env.NODE_DEV === 'production' && 'https://tic-tac-toe-socketio.herokuapp.com' || 'http://localhost:3050'
    })
  ]
};
<commit_msg>wrapped env.host variables with paranthesis<commit_after>'use strict';

const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');

const extractCSS = new ExtractTextPlugin('bundle.css');

module.exports = {
  entry: ['./src/index.js', './style/scss/styles.scss'],
  output: {
    path: path.resolve(__dirname, "dist"),
    publicPath: '/dist/',
    filename: 'bundle.js'
  },
  module: {
    rules:[
      {
        test: /\.js$/,
        use: [{
          loader: 'babel-loader',
          options: {
            presets: ["react", "es2015", "stage-1"]
          }
        }]
      },
      {
        test: /\.scss$/,
        use: extractCSS.extract({
          use: [{
                loader: "css-loader"
              },{
                loader: "postcss-loader",
                options: {
                  plugins: (loader) => [
                    require('postcss-import')({ root: loader.resourcePath }),
                    require('postcss-cssnext')(),
                    require('cssnano')()
                  ]
                }
              },{
                loader: "sass-loader"
              }]
        })
      }
    ]
  },
  devServer: {
    historyApiFallback: true,
    contentBase: './'
  },
  plugins: [
    extractCSS,
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
      'env.host': (process.env.NODE_DEV === 'production' && 'https://tic-tac-toe-socketio.herokuapp.com' || 'http://localhost:3050')
    })
  ]
};
<|endoftext|>


<commit_before>const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')

const pkg = require('./package.json')
// Adds a banner to the top of each generated chunk.
const banner = `
${pkg.description}
v${pkg.version} ©${new Date().getFullYear()} ${pkg.author}
${pkg.homepage}
`.trim()

// helper
const isProd = process.env.NODE_ENV === 'production'
const resolve = (...dir) => path.resolve(__dirname, ...dir)

module.exports = {
  entry: './src/main.js',
  output: {
    path: resolve('dist'),
    publicPath: '/',
    filename: isProd ? 'build.[chunkhash:5].js' : 'build.js'
  },
  resolve: {
    alias: {
      'vue$': 'vue/dist/vue.common.js',
      '@': resolve('src')
    }
  },
  module: {
    rules: [
      // preLoaders
      {
        test: /\.(js|vue)$/,
        enforce: 'pre',
        use: [{
          loader: 'eslint-loader',
          options: {
            formatter: require('eslint-friendly-formatter')
          }
        }],
        include: [resolve('src'), resolve('test')]
      },
      // Loaders
      {
        test: /\.vue$/,
        use: {
          loader: 'vue-loader',
          options: {
            loaders: {
              stylus: ExtractTextPlugin.extract({
                use: 'css-loader?{discardComments:{removeAll:true}}!stylus-loader',
                fallback: 'vue-style-loader'
              })
            }
          }
        }
      },
      {
        test: /\.js$/,
        use: ['babel-loader'],
        include: [resolve('src'), resolve('test')]
      },
      {
        test: /\.(png|jpg|gif|svg)$/,
        use: [{
          loader: 'file-loader',
          options: {
            name: '[name].[ext]?[chunkhash:5]'
          }
        }]
      }
    ],
    noParse: [
      /\.min\.js$/,
      /es6-promise\.js$/
    ]
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: resolve('src', 'tpl.html'),
      filename: 'index.html',
      favicon: require('./src/config').favicon || false,
      minify: {
        // https://github.com/kangax/html-minifier#options-quick-reference
        removeComments: true,
        collapseWhitespace: true
      },
      chunksSortMode: 'dependency'
    }),
    new ExtractTextPlugin({
      filename: isProd ? 'build.[chunkhash:5].css' : 'build.css',
      disable: false,
      allChunks: true
    })
  ],
  devServer: {
    historyApiFallback: true,
    noInfo: true,
    contentBase: 'dist/',
    host: '0.0.0.0'
  },
  devtool: isProd ? false : '#eval-source-map'
}

// production build setting
if (isProd) {
  module.exports.plugins = (module.exports.plugins || []).concat([
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify('production')
    }),
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false
      },
      output: {
        comments: false
      }
    }),
    new webpack.BannerPlugin(banner),
    new CopyWebpackPlugin([
      {
        from: resolve('static'),
        to: resolve('dist'),
        ignore: ['.*']
      }
    ])
  ])
}
<commit_msg>chore: improve webpack devtool<commit_after>const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')

const pkg = require('./package.json')
// Adds a banner to the top of each generated chunk.
const banner = `
${pkg.description}
v${pkg.version} ©${new Date().getFullYear()} ${pkg.author}
${pkg.homepage}
`.trim()

// helper
const isProd = process.env.NODE_ENV === 'production'
const resolve = (...dir) => path.resolve(__dirname, ...dir)

const config = {
  entry: './src/main.js',
  output: {
    path: resolve('dist'),
    publicPath: '/',
    filename: isProd ? 'build.[chunkhash:5].js' : 'build.js'
  },
  resolve: {
    alias: {
      'vue$': 'vue/dist/vue.common.js',
      '@': resolve('src')
    }
  },
  module: {
    rules: [
      // preLoaders
      {
        test: /\.(js|vue)$/,
        enforce: 'pre',
        use: [{
          loader: 'eslint-loader',
          options: {
            formatter: require('eslint-friendly-formatter')
          }
        }],
        include: [resolve('src'), resolve('test')]
      },
      // Loaders
      {
        test: /\.vue$/,
        use: {
          loader: 'vue-loader',
          options: {
            loaders: {
              stylus: ExtractTextPlugin.extract({
                use: 'css-loader?{discardComments:{removeAll:true}}!stylus-loader',
                fallback: 'vue-style-loader'
              })
            }
          }
        }
      },
      {
        test: /\.js$/,
        use: ['babel-loader'],
        include: [resolve('src'), resolve('test')]
      },
      {
        test: /\.(png|jpg|gif|svg)$/,
        use: [{
          loader: 'file-loader',
          options: {
            name: '[name].[ext]?[chunkhash:5]'
          }
        }]
      }
    ],
    noParse: [
      /\.min\.js$/,
      /es6-promise\.js$/
    ]
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: resolve('src', 'tpl.html'),
      filename: 'index.html',
      favicon: require('./src/config').favicon || false,
      minify: {
        // https://github.com/kangax/html-minifier#options-quick-reference
        removeComments: true,
        collapseWhitespace: true
      },
      chunksSortMode: 'dependency'
    }),
    new ExtractTextPlugin({
      filename: isProd ? 'build.[chunkhash:5].css' : 'build.css',
      disable: false,
      allChunks: true
    })
  ],
  devServer: {
    compress: true,
    contentBase: resolve('static'),
    historyApiFallback: true,
    host: '0.0.0.0',
    noInfo: true
  },
  devtool: isProd ? '#cheap-module-source-map' : '#eval-source-map'
}

// production build setting
if (isProd) {
  config.plugins = (config.plugins || []).concat([
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify('production')
    }),
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false
      },
      output: {
        comments: false
      }
    }),
    new webpack.BannerPlugin(banner),
    new CopyWebpackPlugin([
      {
        from: resolve('static'),
        to: resolve('dist'),
        ignore: ['.*']
      }
    ])
  ])
}

module.exports = config
<|endoftext|>


<commit_before>var path = require("path");

module.exports = {
    cache: true,
    entry: "./js/main.js",
    devtool: "#source-map",
    output: {
        path: path.resolve("./build"),
        filename: "bundle.js",
        sourceMapFilename: "[file].map",
        publicPath: "/build/",
        stats: { colors: true },
    },
    module: {
        noParse: [/node_modules\/react/,
                  /node_modules\/jquery/,
                  /bower_components\/MathJax/,
                  /bower_components\/KAS/,
                  /node_modules\/underscore/],
        loaders: [
            {
                //tell webpack to use jsx-loader for all *.jsx files
                test: /\.js$/,
                loader: "regenerator-loader"
            },
            {
                //tell webpack to use jsx-loader for all *.jsx files
                test: /\.js$/,
                loader: "jsx-loader?insertPragma=React.DOM&harmony&stripTypes"
            }
        ],
    },
    resolve: {
        alias: {
            "react": path.resolve("node_modules/react/dist/react.js"),
            "underscore": path.resolve("node_modules/underscore/underscore-min.js"),
            "jquery": path.resolve("node_modules/jquery/dist/jquery.min.js"),
            "katex": path.resolve("bower_components/katex/build/katex.min.js"),
        },
        extensions: ["", ".js", ".jsx"]
    }
}
<commit_msg>Speed up webpack<commit_after>var path = require("path");

module.exports = {
    cache: true,
    entry: "./js/main.js",
    devtool: "#eval-source-map",
    output: {
        path: path.resolve("./build"),
        filename: "bundle.js",
        sourceMapFilename: "[file].map",
        publicPath: "/build/",
        stats: { colors: true },
    },
    module: {
        noParse: [/node_modules\/react/,
                  /node_modules\/jquery/,
                  /bower_components/,
                  /node_modules\/underscore/],
        loaders: [
            {
                //tell webpack to use jsx-loader for all *.jsx files
                test: /models\.js$/,
                loader: "regenerator-loader",
                exclude: [
                    /node_modules/,
                    /bower_components/,
                    /\.min.js$/,
                ],
            },
            {
                //tell webpack to use jsx-loader for all *.jsx files
                test: /\.js$/,
                loader: "jsx-loader?harmony&stripTypes",
                exclude: [
                    /node_modules/,
                    /bower_components/,
                    /\.min.js$/,
                ]
            },
        ],
    },
    resolve: {
        alias: {
            "react": path.resolve("node_modules/react/dist/react.js"),
            "underscore": path.resolve("node_modules/underscore/underscore-min.js"),
            "jquery": path.resolve("node_modules/jquery/dist/jquery.min.js"),
            "katex": path.resolve("bower_components/katex/build/katex.min.js"),
        },
        extensions: ["", ".js", ".jsx"]
    }
}
<|endoftext|>