@@ -5,6 +5,7 @@ import {dirname, basename} from 'path';
55import WebpackDevServer from 'webpack-dev-server' ;
66import MemoryFS from 'memory-fs' ;
77import serveStatic from 'serve-static' ;
8+ import { isProduction , babelFEOptions } from './util' ;
89
910/* eslint-disable no-process-env */
1011
@@ -26,64 +27,9 @@ const cache = {},
2627 * You can use it to tweak the Babel options.
2728 *
2829 * @module webpack
30+ * @private
2931 */
3032
31- /**
32- * `true` if the `NODE_ENV` environment variable is set to `'production'`
33- *
34- * @memberof module:webpack
35- * @constant {boolean} isProduction
36- */
37- export const isProduction = 'production' === process . env . NODE_ENV ;
38-
39- /**
40- * Babel configuration for the Node.js.
41- *
42- * @memberof module:webpack
43- * @member {Object} babelBEOptions
44- * @example
45- * import {babelBEOptions} from 'webcompiler';
46- * // or - import {babelBEOptions} from 'webcompiler/lib/webpack';
47- * // or - var babelBEOptions = require('webcompiler').babelBEOptions;
48- * // or - var babelBEOptions = require('webcompiler/lib/webpack').babelBEOptions;
49- *
50- * babelFEOptions.presets.push('my-custom-preset');
51- */
52- export const babelBEOptions = {
53- babelrc : false ,
54- presets : [ 'es2016' , 'es2017' , 'stage-2' , 'react' ] ,
55- plugins : [
56- [ 'transform-es2015-modules-commonjs' , { loose : true } ]
57- ]
58- } ;
59-
60- /**
61- * Babel configuration for the browser.
62- *
63- * @memberof module:webpack
64- * @member {Object} babelFEOptions
65- * @example
66- * import {babelFEOptions} from 'webcompiler';
67- * // or - import {babelFEOptions} from 'webcompiler/lib/webpack';
68- * // or - var babelFEOptions = require('webcompiler').babelFEOptions;
69- * // or - var babelFEOptions = require('webcompiler/lib/webpack').babelFEOptions;
70- *
71- * babelFEOptions.presets.push('my-custom-preset');
72- */
73- export const babelFEOptions = {
74- cacheDirectory : true ,
75- babelrc : false ,
76- presets : [
77- [ 'es2015' , {
78- // temporarily disabled until `webpack` 2.3 and `webpack-hot-loader` 3.0 are available
79- // modules: false,
80- loose : true
81- } ] ,
82- 'es2016' , 'es2017' , 'stage-2' , 'react'
83- ] ,
84- plugins : [ 'transform-runtime' ]
85- } ;
86-
8733/**
8834 * Returns a webpack configuration object.
8935 *
0 commit comments