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

Webpack defined but never used. #573

Closed
noahtallen opened this issue Jul 23, 2016 · 4 comments

Comments

@noahtallen
Copy link

commented Jul 23, 2016

I just installed standard js in Atom to clean up a few of my files. I was going through my webpack.config.js file and it's catching var webpack = require('webpack') and saying webpack is never used. Looked around for a while but never found anything that could fix this.

@feross

This comment has been minimized.

Copy link
Member

commented Jul 23, 2016

The webpack variable is probably not being used.

Can you post your entire webpack.config.js file?

@feross feross added the question label Jul 23, 2016

@feross feross closed this Jul 23, 2016

@noahtallen

This comment has been minimized.

Copy link
Author

commented Jul 23, 2016

I know the variable isn't being used in this config - I believe I was following a tutorial that included it, which is why I stuck it up there. I know sometimes with React you import React (and used to set it up as a var), but you sometimes wouldn't be directly referencing React itself. But it was still needed. Not sure if that's the same for webpack or not. I'm pretty new to js frameworks. :P

'use strict'
var path = require('path')
var webpack = require('webpack')

module.exports = {
  // Where webpack starts packaging.
  entry: [
    'babel-polyfill',
    './src/Index.jsx'
  ],
  // Where it places the final, packaged file.
  output: {
    path: __dirname,
    publicPath: '/',
    filename: './dist/bundle.js'
  },
  // Displays source code in the browser, as opposed to the bundle. Remove for public build.
  devtool: 'source-map',
  module: {
    loaders: [
      {
        test: /\jsx$/,
        exclude: path.join(__dirname, 'node_modules'),
        loader: 'babel-loader'
      }, {
        test: /\.js/,
        include: path.join(__dirname, 'node_modules/auth0-lock'),
        loaders: ['transform?packageify', 'transform?brfs']
      }, {
        test: /\.ejs/,
        include: path.join(__dirname, 'node_modules/auth0-lock/'),
        loader: 'transform?ejsify'
      }, {
        test: /\.json/,
        include: path.join(__dirname, 'node_modules/auth0-lock/i18n/ru.json'),
        loader: 'json'
      }, {
        test: /\.js$/,
        exclude: path.join(__dirname, 'node_modules'),
        loader: 'babel-loader'
      }
    ]
  },
  devServer: {
    historyApiFallback: true,
    contentBase: './'
  },
  // Tells the loaders we don't have to make release code.
  debug: true
}
@feross

This comment has been minimized.

Copy link
Member

commented Jul 23, 2016

You can probably just remove that line from your config and you're good to go! It's not needed.

The React situation is a bit different. With React, you're requiring it because later the JSX compiler is going to replace the JSX with calls to React.createComponent, so you need React to be defined as a variable.

@noahtallen

This comment has been minimized.

Copy link
Author

commented Jul 23, 2016

Makes sense! Thanks.

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
2 participants
You can’t perform that action at this time.