Break babelrc out of webpack config
authorRandall Leeds <randall@apache.org>
Sun, 12 Nov 2017 23:01:14 +0000 (15:01 -0800)
committerRandall Leeds <randall@apache.org>
Sun, 12 Nov 2017 23:03:40 +0000 (15:03 -0800)
Rather than anticipating the use of webpack for publishing bundles this
anticipates using babel directly to publish modules.

.babelrc [new file with mode: 0644]
webpack.config.js

diff --git a/.babelrc b/.babelrc
new file mode 100644 (file)
index 0000000..44ac630
--- /dev/null
+++ b/.babelrc
@@ -0,0 +1,39 @@
+{
+  plugins: [
+    [
+      "@babel/transform-runtime",
+      {
+        // Externalize babel helpers for bundle size improvements.
+        helpers: true,
+        // Do not polyfill; leave that to applications.
+        polyfill: false,
+        // Do not rely on a global regenerator runtime.
+        regenerator: true,
+        // Do not import polyfills for helpers.
+        useBuiltIns: true,
+        // Do not transform helper modules.
+        useESModules: true,
+      },
+    ],
+  ],
+  presets: [
+    [
+      "@babel/env",
+      {
+        // Do not transform modules; webpack can do that.
+        modules: false,
+        // Enabled proposals that have shipped in browsers.
+        shippedProposals: true,
+        // Set target environments.
+        targets: {
+          // Browsers: > 1%, last 2 versions, Firefox ESR
+          browsers: ["defaults"],
+          // Node: LTS
+          node: "6.0",
+        },
+        // Use a minimal @babel/polyfill.
+        useBuiltIns: "entry",
+      },
+    ],
+  ],
+}
index 06bc6b3..b9dbc76 100644 (file)
@@ -36,48 +36,7 @@ module.exports = {
       {
         test: /\.js$/,
         exclude: /node_modules/,
-        use: {
-          loader: 'babel-loader',
-          options: {
-            plugins: [
-              [
-                '@babel/transform-runtime',
-                {
-                  // Externalize babel helpers for bundle size improvements.
-                  helpers: true,
-                  // Do not polyfill; leave that to applications.
-                  polyfill: false,
-                  // Do not rely on a global regenerator runtime.
-                  regenerator: true,
-                  // Do not import polyfills for helpers.
-                  useBuiltIns: true,
-                  // Do not transform helper modules.
-                  useESModules: true,
-                },
-              ],
-            ],
-            presets: [
-              [
-                '@babel/env',
-                {
-                  // Do not transform modules; webpack can do that.
-                  modules: false,
-                  // Enabled proposals that have shipped in browsers.
-                  shippedProposals: true,
-                  // Set target environments.
-                  targets: {
-                    // Browsers: > 1%, last 2 versions, Firefox ESR
-                    browsers: ['defaults'],
-                    // Node: LTS
-                    node: '6.0',
-                  },
-                  // Use a minimal @babel/polyfill.
-                  useBuiltIns: 'entry',
-                },
-              ],
-            ],
-          },
-        },
+        use: 'babel-loader',
       },
     ],
   },