caiogondim / webpack-conditional-loader

C conditionals directive for JavaScript
https://npm.im/webpack-conditional-loader
MIT License
110 stars 25 forks source link

Webpack 3 support #2

Closed Darmikon closed 7 years ago

Darmikon commented 7 years ago

Hi there. Does it work with webpack 3. Or if no then are you planning updates?

Darmikon commented 7 years ago

Update:

{
            test: /\.(js|jsx)$/,
            include: paths.appSrc,
            use: [
              {
                loader: require.resolve('babel-loader'),
                options: {
                  cacheDirectory: true,
                },
              },
              {
                loader: 'webpack-conditional-loader'
              }
            ]
}

As far as I see it works with such config

// #if process.env.NODE_ENV === 'development'
console.log('lorem');
console.log('ipsum');
// #endif

When NODE_ENV !=='development' entire block has been commented