Skip to content

Commit

Permalink
Change devtool for production build to source-map
Browse files Browse the repository at this point in the history
  • Loading branch information
fson authored and KyleAMathews committed Oct 3, 2015
1 parent a269d59 commit c115774
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions lib/utils/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import webpack from 'webpack';
import StaticSiteGeneratorPlugin from 'static-site-generator-webpack-plugin';

module.exports = function(program, directory, stage, webpackPort = 1500, routes=[]) {
var output = function() {
const output = function() {
switch (stage) {
case "serve":
return {path: directory,
Expand All @@ -18,7 +18,7 @@ module.exports = function(program, directory, stage, webpackPort = 1500, routes=
}
};

var entry = function() {
const entry = function() {
switch (stage) {
case "serve":
return [
Expand All @@ -37,7 +37,18 @@ module.exports = function(program, directory, stage, webpackPort = 1500, routes=
}
};

var plugins = function() {
const devtool = function() {
switch (stage) {
case "serve":
return "eval"
case "static":
return "eval"
case "production":
return "source-map"
}
}

const plugins = function() {
switch (stage) {
case "serve":
return [
Expand Down Expand Up @@ -71,14 +82,14 @@ module.exports = function(program, directory, stage, webpackPort = 1500, routes=
}
};

var resolve = function() {
const resolve = function() {
return {
extensions: ['', '.js', '.jsx', '.cjsx', '.coffee', '.json', '.less', '.toml', '.yaml'],
modulesDirectories: [directory, `${__dirname}/../isomorphic`, `${directory}/node_modules`, "node_modules"]
};
};

var module = function() {
const module = function() {
switch (stage) {
case "serve":
return {loaders: [
Expand Down Expand Up @@ -179,7 +190,7 @@ module.exports = function(program, directory, stage, webpackPort = 1500, routes=
},
entry: entry(),
debug: true,
devtool: 'eval',
devtool: devtool(),
output: output(),
resolveLoader: {
modulesDirectories: [`${__dirname}/../../node_modules`, `${__dirname}/../loaders`]
Expand Down

0 comments on commit c115774

Please sign in to comment.