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

OriginalSource Cannot read property 'columns' of undefined when use devServer in webpack.config.js #149

Closed
lenage opened this issue Apr 9, 2015 · 5 comments · May be fixed by dwayne45/webpack-dev-server#5 or signal-noise/webpack-dev-server#4

Comments

@lenage
Copy link

lenage commented Apr 9, 2015

Hi, I got an error when use devServer in webpack.config.js, but it works ok when i use command line options. see below.

 [423] (webpack)/~/node-libs-browser/~/util/~/inherits/inherits_browser.js 672 bytes {0} [built]
  [424] (webpack)/~/node-libs-browser/~/util/support/isBufferBrowser.js 203 bytes {0} [built]
  [425] ./~/webpack/hot/dev-server.js 1.79 kB {0} [built]

ERROR in main.js from UglifyJs
TypeError: Cannot read property 'columns' of undefined
    at /Users/lenage/Projects/engzo/mihawk/node_modules/webpack-dev-server/node_modules/webpack/node_modules/webpack-core/lib/OriginalSource.js:61:14
    at Array.map (native)
    at OriginalSource.node (/Users/lenage/Projects/engzo/mihawk/node_modules/webpack-dev-server/node_modules/webpack/node_modules/webpack-core/lib/OriginalSource.js:59:9)
    at ReplaceSource.node (/Users/lenage/Projects/engzo/mihawk/node_modules/webpack-dev-server/node_modules/webpack/node_modules/webpack-core/lib/ReplaceSource.js:55:29)
    at CachedSource.node (/Users/lenage/Projects/engzo/mihawk/node_modules/webpack-dev-server/node_modules/webpack/node_modules/webpack-core/lib/CachedSource.js:41:22)
    at PrefixSource.node (/Users/lenage/Projects/engzo/mihawk/node_modules/webpack-dev-server/node_modules/webpack/node_modules/webpack-core/lib/PrefixSource.js:27:26)
    at /Users/lenage/Projects/engzo/mihawk/node_modules/webpack-dev-server/node_modules/webpack/node_modules/webpack-core/lib/ConcatSource.js:38:49
    at Array.map (native)
    at ConcatSource.node (/Users/lenage/Projects/engzo/mihawk/node_modules/webpack-dev-server/node_modules/webpack/node_modules/webpack-core/lib/ConcatSource.js:37:60)

My webpack.config.js:

/* global process */
var path = require("path");
var webpack = require("webpack");

var globalTag = new webpack.DefinePlugin({
  __DEV__: JSON.stringify(JSON.parse(process.env.BUILD_DEV || 'true')),
  __PRERELEASE__: JSON.stringify(JSON.parse(process.env.BUILD_PRERELEASE || 'false'))
});

var config = {
    cache: true,
    entry: [
        'webpack/hot/dev-server',
        './client.js'],
    output: {
        path: process.env.NODE_ENV === 'production' ? './dist/assets' : './build/assets',
        publicPath: "public/assets/",
        filename: "[name].js",
        chunkFilename: "[chunkhash].js"
    },
    devServer: {
        info: false, //  --no-info option
        hot: true,
        colors: true,
        proxy: {
            "*": 'http://iam.dev:4000'
        }
    },
    module: {
        loaders: [
              //.......
        ]
    },
    resolve: {
        extensions: ['', '.js', '.jsx', '.css', '.styl', '.coffee'],
        root: [path.join(__dirname, "bower_components")]
    },
    plugins: [
        globalTag,
        new webpack.ResolverPlugin(
            new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin("bower.json", ["main"])
        ),
        new webpack.optimize.DedupePlugin(),
        new webpack.optimize.OccurenceOrderPlugin(),
        new webpack.optimize.UglifyJsPlugin()]
};

module.exports = config;

and below command line options works for me:

webpack-dev-server --devtool eval --colors --hot --content-base-target 'http://mihawk.dev:4000'

I checked OriginalSource.js#61, and seem like options was undefined.
I try to fix it at lenage/webpack-core@7601bec , but it's turns out all my css not required.

any idea?

@kentcdodds
Copy link
Member

I am also seeing this. Though I'm seeing it with webpack in general. So I'm guessing it's a webpack-core issue.

@kentcdodds
Copy link
Member

My solution for now is to simply downgrade to the latest 1.7.x release :-( Let me know if there's any info I can provide to figure out what the issue is.

@pcostanz
Copy link

pcostanz commented Jun 8, 2015

I fixed the errors in this issue by upgrading less and less-loader dependencies, but my styles were still not being loaded. I ended up actually resolving the problem (that my styles were not being included correctly) by then bumping my extract-text-webpack-plugin dependency.

Here's a snippet of my current (working) versions for the loaders and plugins that were involved with this issue for my project:

    "babel-loader": "5.1.4",
    "extract-text-webpack-plugin": "0.8.1",
    "less": "2.5.1",
    "less-loader": "2.2.0",

@SpaceK33z
Copy link
Member

Closing issue because it was either webpack(not dev-server), or less. If anyone still has this issue, feel free to comment and I'll re-open.

@ashish9719
Copy link

I am facing the same issue, Cannot read property originalSource of undefined.
I don't have any property called originalSource. I am trying to use GridLayout
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants