Webpack extension which improves universal application development.
After Webpack 5 release (2020-10-10), major changes are needed to make udk compatible.
We ignore what will be the future of udk for a possible next major release: maybe we will focus on the main feature which enhances multicompilers dependencies in sequential way.
When developments started, we thought that webpack multicompiler module was a great feature to optimize building workflows. But we found that multicompiler is rarely used.
udk packages will continue working indefinitely so no immediate changes are necessary.
npm install --save-dev udk webpack
// webpack.config.js
const mode = process.env.NODE_ENV === 'production' ? 'production' : 'development';
const client = {
name: 'client',
entry: './src/client.js',
output: {
path: __dirname + '/dist',
filename: 'client.js'
}
};
const server = {
name: 'server',
dependencies: [ client.name ], // server depends on client
entry: './src/server.js',
output: {
path: __dirname + '/dist',
filename: 'server.js'
}
};
module.exports = [ client, server ]; // webpack multi config
// src/client.js
import './shared';
console.log('Hello, client');
// src/server.js
import './shared';
console.log('Hello, server');
// src/shared.js
console.log('Hello, shared');
DEBUG=udk:* npx udk --config webpack.config.js --watch
Now, try to update each file and check the output:
client.js
to check that server compiler will be invalidate when client compiler done ;server.js
to check that sever compiler will be the only one compiler invalided ;shared.js
to check that server compiler will wait client compiler done before compile too ;shared.js
with a syntax error to check that server won't compile because client compiler has error ;shared.js
to fix syntax error and check client and server compilers will run in serie.Run webpack --config webpack.config.js --watch
and try the same updates to check the difference between webpack and udk multi compiler behavior.
Under the hood, udk extends MultiCompiler only to ensure some behaviors:
Same as webpack CLI.
udk [--config webpack.config.js]
udk <entry> [<entry>] <output>
All webpack CLIs are supported:
See docs/api.md.
See docs/faq.md.