Skip to content

Commit eca739a

Browse files
committed
Export an environment instance *and* the base class
Mostly so we're not locked in to exporting a single value
1 parent 1474d39 commit eca739a

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
const environment = require('webpacker')
1+
const { environment } = require('webpacker')
22

33
module.exports = environment.toWebpackConfig()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
const environment = require('webpacker')
1+
const { environment } = require('webpacker')
22

33
module.exports = environment.toWebpackConfig()

lib/install/config/webpack/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
const environment = require('webpacker')
1+
const { environment } = require('webpacker')
22

33
module.exports = environment.toWebpackConfig()

node_module/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
/* eslint global-require: 0 */
22
/* eslint import/no-dynamic-require: 0 */
33

4+
const Environment = require('./environment')
45
const { existsSync } = require('fs')
56

6-
function createEnvironmentInstance() {
7-
let path = `./environments/${process.env.NODE_ENV}`
8-
if (!existsSync(path)) {
9-
path = './environment'
10-
}
11-
const constructor = require(path)
7+
function createEnvironment() {
8+
const path = `./environments/${process.env.NODE_ENV}`
9+
const constructor = existsSync(path) ? require(path) : Environment
1210
return new constructor()
1311
}
1412

15-
module.exports = createEnvironmentInstance()
13+
const environment = createEnvironment()
14+
15+
module.exports = { environment, Environment }

0 commit comments

Comments
 (0)