Skip to content

Moved querying of environment variable #27

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

Merged
merged 2 commits into from
Jul 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ var loaderSchema = require('./schema/loader-schema');
var pluginSchema = require('./schema/plugin-schema.json');

var NS = fs.realpathSync(__dirname);
var DEV = process.env.NODE_ENV === 'development';
var nextId = 0;

function ExtractTextPluginCompilation() {
Expand Down Expand Up @@ -108,7 +107,7 @@ function ExtractTextPlugin(options) {
} else {
schemaTester(pluginSchema, options);
}
this.filename = options.filename || (DEV ? '[name].css' : '[name].[contenthash].css');
this.filename = options.filename || (process.env.NODE_ENV === 'development' ? '[name].css' : '[name].[contenthash].css');
this.id = options.id != null ? options.id : ++nextId;
this.options = {};
mergeOptions(this.options, options);
Expand Down Expand Up @@ -292,7 +291,7 @@ ExtractTextPlugin.prototype.apply = function(compiler) {

// HMR: inject file name into corresponding javascript modules in order to trigger
// appropriate hot module reloading of CSS
if (DEV) {
if (process.env.NODE_ENV === 'development') {
compilation.plugin("before-chunk-assets", function() {
extractedChunks.forEach(function(extractedChunk) {
extractedChunk.modules.forEach(function(module) {
Expand Down
3 changes: 1 addition & 2 deletions loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ var SingleEntryPlugin = require("webpack/lib/SingleEntryPlugin");
var LimitChunkCountPlugin = require("webpack/lib/optimize/LimitChunkCountPlugin");

var NS = fs.realpathSync(__dirname);
var DEV = process.env.NODE_ENV === 'development'

module.exports = function(source) {
return source;
Expand Down Expand Up @@ -133,7 +132,7 @@ module.exports.pitch = function(request) {
//
// All we need is a date that changes during dev, to trigger a reload since
// hashes generated based on the file contents are what trigger HMR.
if (DEV) {
if (process.env.NODE_ENV === 'development') {
resultSource += `
if (module.hot) {
module.hot.accept();
Expand Down