mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
This adds support for filter-like function for white-listing modules as per existing documentation: https://github.com/liady/webpack-node-externals#optionswhitelist- - definition change - tests updated Thanks!
101 lines
2.2 KiB
TypeScript
101 lines
2.2 KiB
TypeScript
import webpack = require('webpack');
|
|
import webpackNodeExternals = require('webpack-node-externals');
|
|
|
|
const a: webpack.Configuration = {
|
|
entry: 'test.js',
|
|
externals: [
|
|
webpackNodeExternals()
|
|
]
|
|
};
|
|
const b: webpack.Configuration = {
|
|
entry: 'test.js',
|
|
externals: webpackNodeExternals()
|
|
};
|
|
const c: webpack.Configuration = {
|
|
entry: 'test.js',
|
|
externals: [
|
|
webpackNodeExternals({
|
|
whitelist: [
|
|
'jquery',
|
|
'webpack/hot/dev-server',
|
|
/^lodash/,
|
|
(moduleName: string) => moduleName === 'moduleF',
|
|
],
|
|
}),
|
|
],
|
|
};
|
|
const d: webpack.Configuration = {
|
|
entry: 'test.js',
|
|
externals: [
|
|
webpackNodeExternals({
|
|
importType: (moduleName) => {
|
|
return 'commonjs';
|
|
}
|
|
})
|
|
]
|
|
};
|
|
const e: webpack.Configuration = {
|
|
entry: 'test.js',
|
|
externals: [
|
|
webpackNodeExternals({
|
|
modulesFromFile: {
|
|
exclude: 'devDependencies'
|
|
}
|
|
})
|
|
]
|
|
};
|
|
const f: webpack.Configuration = {
|
|
entry: 'test.js',
|
|
externals: [
|
|
webpackNodeExternals({
|
|
modulesFromFile: {
|
|
exclude: ['devDependencies']
|
|
}
|
|
})
|
|
]
|
|
};
|
|
const g: webpack.Configuration = {
|
|
entry: 'test.js',
|
|
externals: [
|
|
webpackNodeExternals({
|
|
modulesFromFile: {
|
|
include: 'dependencies'
|
|
}
|
|
})
|
|
]
|
|
};
|
|
const h: webpack.Configuration = {
|
|
entry: 'test.js',
|
|
externals: [
|
|
webpackNodeExternals({
|
|
modulesFromFile: {
|
|
include: ['dependencies']
|
|
}
|
|
})
|
|
]
|
|
};
|
|
const i: webpack.Configuration = {
|
|
entry: 'test.js',
|
|
externals: [
|
|
webpackNodeExternals({
|
|
includeAbsolutePaths: true,
|
|
}),
|
|
],
|
|
};
|
|
const j: webpack.Configuration = {
|
|
entry: 'test.js',
|
|
externals: [
|
|
webpackNodeExternals({
|
|
modulesDir: 'node_modules/somepackage/node_modules',
|
|
}),
|
|
],
|
|
};
|
|
const k: webpack.Configuration = {
|
|
entry: 'test.js',
|
|
externals: [
|
|
webpackNodeExternals({
|
|
binaryDirs: ['.bin', '._bin'],
|
|
}),
|
|
],
|
|
};
|