3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

babel, babelify, browserify でブラウザアプリで環境変数を process.env から使うには

Posted at

babel v5.8.23, babelify v7.1.0, browserify v11.2.0 で、ブラウザアプリで環境変数を process.env から使うのに、babel-plugin-transform-node-env-inline v6.3.13 を導入しました。

gulp タスクのサンプルです。

.javascript
  var bundler = browserify({
    // required watchify args
    cache: {}, packageCache: {},
    // Browserify options
    entries: [HOGE],
    debug: true
  })
  .transform(babelify, {plugins: "transform-node-env-inline", presets: ["es2015", "react", "stage-2"]})
  .transform(browserifyShim);

URL

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?