Skip to content
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

Using ExtendedDefinePlugin #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

arikmaor
Copy link

@arikmaor arikmaor commented Dec 9, 2015

This guide helped me a lot learning webpack basics
I wrote a wrapper for define plugin, I wish you to consider using it in your guide

it does the JSON.stringify() part for you so you can also include config files like this:

// app.config.js
module.exports = {
    dev: {
        api_key: '1234567890ABCDEFG'
        fb_conf: {
          use_social: true,
          api_key: '123456790'
        }
    },
    prod: {
        api_key: '1234567890ABCDEFG'
        fb_conf: {
          use_social: true,
          api_key: '123456790'
        }
    }
};
// webpack.config.js

var ExtendedDefinePlugin = require('extended-define-webpack-plugin');
var appConfig = require('./app.config.js');

module.exports = {
  // ...
  plugins: [
    /* ..., */
    new ExtendedDefinePlugin({
      APP_CONFIG: appConfig[process.env.NODE_ENV],
    })
  ]
};

@bebraw
Copy link

bebraw commented Aug 2, 2016

Did you see EnvironmentPlugin? It gets quite close.

@arikmaor
Copy link
Author

arikmaor commented Aug 2, 2016

It didn't exist when I wrote my plugin.
I agree it looks like they do the same job.

On Tuesday, August 2, 2016, Juho Vepsäläinen [email protected]
wrote:

Did you see EnvironmentPlugin
https://webpack.github.io/docs/list-of-plugins.html#environmentplugin?
It gets quite close.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#47 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AB1kY_Qyi1fihKPlpLlIfPqy6YBIkI-rks5qb3eQgaJpZM4GyTJg
.

Arik Maor
[email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants