-
Notifications
You must be signed in to change notification settings - Fork 18
Changelog
In favour of simplicity:
-
Removed some exported instances:
-
builder
-
loader
, instead ofloader.loadConfig
please use:import Config from 'webpack-config'; export default = new Config().extend('./conf/webpack.development.config.js');
-
finder
, please usefs
module to walk through directory tree and find the appropriate path which meets your requirements -
stringResolver
-
pathResolver
-
factory
-
-
Removed some exported classes:
ConfigBuilder
ConfigPatternCache
ConfigCache
ConfigLoader
ConfigFinder
ConfigStringResolver
-
Removed
FILENAME
static constant fromConfig
class, please use instead:import { FILENAME } from 'webpack-config';
-
Now constructor dependencies automatically injected by constitute.
-
Removed
Config*.INSTANCE
methods.
Now they can be accessible via require
/import
:
Before
import { ConfigEnvironment, ConfigCache } from 'webpack-config';
const environment = ConfigEnvironment.INSTANCE,
cache = ConfigCache.INSTANCE;
const ConfigEnvironment = require('webpack-config').ConfigEnvironment,
ConfigCache = require('webpack-config').ConfigCache;
const environment = ConfigEnvironment.INSTANCE,
cache = ConfigCache.INSTANCE;
After
import { environment, cache } from 'webpack-config';
const environment = require('webpack-config').environment,
cache = require('webpack-config').cache;
- Added support of
webpack-config-<name>
naming convention:
import Config from 'webpack-config';
// Loads from `node_modules/webpack-config-my/webpack.config.js`
export default new Config().extend('my/webpack.config.js');
Also you can use:
import Config from 'webpack-config';
// Loads from `node_modules/react-redux/webpack.config.js`
export default new Config().extend('react-redux/webpack.config.js');
- Exposed
ConfigPatternCache
to make posible to overrideConfigPatternCache#interpolate
property:
ConfigPatternCache.INSTANCE.interpolate = /{{([\s\S]+?)}}/g;
import {
Config,
ConfigEnvironment
} from 'webpack-config';
ConfigEnvironment.INSTANCE.setAll({
env: () => process.env.WEBPACK_ENV || process.env.NODE_ENV
});
export default new Config().extend('./conf/webpack.{{ env }}.config.js');
-
Added some new methods
Config#set
,Config#remove
,Config#get
,Config#has
. -
Added
ConfigBuilder
which helps to build config based onConfig
orConfigList
. Also it supports hooks viaConfigBuilder#applyHooks
.
- Moved some
Config.*
static methods to external modules. Now they can be accessible viarequire
/import
:
var Config = require('webpack-config') |
import { * } from 'webpack-config' |
|
---|---|---|
Config.Loader |
~> |
ConfigLoader |
Config.Finder |
~> |
ConfigFinder |
Config.Environment |
~> |
ConfigEnvironment |
var Config = require('webpack-config');
Config.environment.setAll({
env: function() {
return process.env.WEBPACK_ENV || process.env.NODE_ENV;
}
});
modules.exports = new Config().extend('./conf/webpack.[env].config.js');
import {
Config,
ConfigEnvironment
} from 'webpack-config';
ConfigEnvironment.INSTANCE.setAll({
env: () => process.env.WEBPACK_ENV || process.env.NODE_ENV
});
export default new Config().extend('./conf/webpack.[env].config.js');
- Added
dependencyTree
property which holds information about allextend
method calls:
import Config from 'webpack-config';
let config = new Config();
config.extend('./test/fixtures/webpack.1.config.js');
for (let {node} of config.dependencyTree) {
console.log(node.root.filename);
}
// ./test/fixtures/webpack.1.config.js
// ./test/fixtures/webpack.2.config.js
// ./test/fixtures/webpack.3.config.js
// ./test/fixtures/webpack.5.config.js
// ./test/fixtures/webpack.4.config.js
-
Now
ConfigFinder
methods return full paths to configs instead of instances ofConfig
/Config[]
. -
Added
ConfigCache
which holds caches ofConfig
/Config[]
.
Now it is easily make it non persistent via WEBPACK_CONFIG_CACHE=false
environment variable or ConfigCache#persistent
property:
WEBPACK_CONFIG_CACHE=false npm run build
import {
ConfigCache
} from 'webpack-config';
ConfigCache.INSTANCE.persistent = false;