build-plugin-rax-app
Version:
The basic webpack configuration for rax project
116 lines • 3.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var app_helpers_1 = require("@builder/app-helpers");
var compat_webpack4_1 = require("@builder/compat-webpack4");
var devServerDefaultOptionsMap = {
webpack4: {
allowedHosts: 'all',
compress: true,
// Use 'ws' instead of 'sockjs-node' on server since webpackHotDevClient is using native websocket
disableHostCheck: true,
logLevel: 'silent',
transportMode: 'ws',
sockPath: '/ws',
quiet: false,
publicPath: '/',
clientLogLevel: 'none',
watchOptions: {
ignored: /node_modules/,
aggregateTimeout: 600,
},
before: function (app) {
app.use(function (req, res, next) {
// set cros for all served files
res.set('Access-Control-Allow-Origin', '*');
next();
});
},
hot: true,
// For mutilple task, web will occupy the server root route
writeToDisk: true,
historyApiFallback: true,
},
webpack5: {
allowedHosts: 'all',
compress: true,
hot: true,
static: {
watch: {
ignored: /node_modules/,
aggregateTimeout: 600,
},
},
client: {
overlay: {
errors: true,
warnings: false,
},
},
onBeforeSetupMiddleware: function (_a) {
var app = _a.app;
app.use(function (req, res, next) {
// set cros for all served files
res.set('Access-Control-Allow-Origin', '*');
next();
});
},
// For mutilple task, web will occupy the server root route
devMiddleware: {
writeToDisk: true,
publicPath: '/',
},
liveReload: false,
historyApiFallback: true,
},
};
var webpackVersion = compat_webpack4_1.isWebpack4 ? 'webpack4' : 'webpack5';
var devServerDefaultOptions = devServerDefaultOptionsMap[webpackVersion];
exports.default = [
{
name: 'devServer',
validation: 'object',
defaultValue: devServerDefaultOptions,
},
{
name: 'outputAssetsPath',
defaultValue: {
js: '',
css: '',
},
},
{
name: 'inlineStyle',
defaultValue: false,
configWebpack: require('../userConfig/atoms/inlineStyle'),
validation: function (val) {
return (0, app_helpers_1.validation)('inlineStyle', val, 'boolean|object');
},
},
{
name: 'polyfill',
defaultValue: false,
},
{
name: 'compileDependencies',
defaultValue: [''],
},
{
name: 'vendor',
defaultValue: true,
configWebpack: require('../userConfig/atoms/vendor'),
},
{
name: 'webpack5',
defaultValue: false,
},
{
name: 'terserOptions',
validation: 'object',
defaultValue: {},
},
{
name: 'esbuild',
validation: 'object',
},
];
//# sourceMappingURL=user.config.js.map