Skip to content

Doesn't work #5

@valentinvoilean

Description

@valentinvoilean

This is my webpack configuration:

rules: [
      {
        test: /\.jsx?$/,
        exclude: [/node_modules/],
        loader: ['babel-loader', 'webpack-conditional-loader']
      }
],

plugins: [
new webpack.EnvironmentPlugin({
      NODE_ENV: 'production',
      BROWSER: true
    }),
]

Then, in my file I use this:

// #if process.env.NODE_ENV !== 'production'
import moment from 'moment';
// #endif

The moment library is still imported.

It works only if I do:

// #if process.env.NODE_ENV === 'anything_other_value'
import moment from 'moment';
// #endif

This means, the process.env.NODE_ENV is undefined.

I'm using:
"webpack": "^3.9.1",
"webpack-conditional-loader": "^1.0.11",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions