Skip to content
This repository was archived by the owner on Aug 20, 2018. It is now read-only.
This repository was archived by the owner on Aug 20, 2018. It is now read-only.

what wrong? #23

@Maxim-Chugaev

Description

@Maxim-Chugaev
module.exports = function(source) {
    this.cacheable && this.cacheable();
    console.log(source);
    var value = typeof source === "string" ? JSON.parse(source) : source;
    this.value = [value];
    return "module.exports = " + JSON.stringify(value, undefined, "\t") + ";";
}

console.log output

{}
module.exports = {};

Error: Unexpected token m in JSON at position 0

Webpack config

var webpack = require('webpack');

module.exports = {

  entry: './app/driver.js',

  externals: {
    'jquery': '$'
  },

  module: {
    loaders: [
      {
        test: /\.json$/,
        loader: "json-loader" 
      },
      {
        test: /\.html$/,
        loader: 'underscore-template-loader'
      }
    ]
  },

  output: {
    path: __dirname + '/static/js',
    filename: 'bundle.js'
  },

  plugins: [
    new webpack.ProvidePlugin({
      _: 'underscore'
    })
  ],

  resolve: {
    modulesDirectories: [__dirname + '/node_modules'],
    root: __dirname + '/app'
  },

  resolveLoader: {
    root: __dirname + '/node_modules'
  }

};

node v6.0.0

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions