Format js config file

This commit is contained in:
Franck Royer 2022-01-07 15:18:37 +11:00
parent e18c4f1619
commit add78bce71
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
2 changed files with 27 additions and 27 deletions

View File

@ -6,27 +6,27 @@ module.exports = {
if (!config.resolve) config.resolve = {}; if (!config.resolve) config.resolve = {};
if (!config.resolve.fallback) config.resolve.fallback = {}; if (!config.resolve.fallback) config.resolve.fallback = {};
Object.assign(config.resolve.fallback, { Object.assign(config.resolve.fallback, {
"buffer": require.resolve("buffer"), buffer: require.resolve('buffer'),
"crypto": require.resolve("crypto-browserify"), crypto: require.resolve('crypto-browserify'),
"stream": require.resolve("stream-browserify"), stream: require.resolve('stream-browserify'),
// "assert": require.resolve("assert") // "assert": require.resolve("assert")
} });
)
if (!config.plugins) config.plugins = [] if (!config.plugins) config.plugins = [];
config.plugins.push( config.plugins.push(
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env.ENV': JSON.stringify("dev"), 'process.env.ENV': JSON.stringify('dev'),
}) })
) );
config.plugins.push( config.plugins.push(
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({
process: 'process/browser.js', process: 'process/browser.js',
Buffer: ['buffer', 'Buffer'], Buffer: ['buffer', 'Buffer'],
})); })
);
if (!config.ignoreWarnings) config.ignoreWarnings = [] if (!config.ignoreWarnings) config.ignoreWarnings = [];
config.ignoreWarnings.push(/Failed to parse source map/) config.ignoreWarnings.push(/Failed to parse source map/);
return config; return config;
}, },
@ -35,28 +35,28 @@ module.exports = {
if (!config.resolve) config.resolve = {}; if (!config.resolve) config.resolve = {};
if (!config.resolve.fallback) config.resolve.fallback = {}; if (!config.resolve.fallback) config.resolve.fallback = {};
Object.assign(config.resolve.fallback, { Object.assign(config.resolve.fallback, {
"buffer": require.resolve("buffer"), buffer: require.resolve('buffer'),
"crypto": require.resolve("crypto-browserify"), crypto: require.resolve('crypto-browserify'),
"stream": require.resolve("stream-browserify"), stream: require.resolve('stream-browserify'),
// "assert": require.resolve("assert") // "assert": require.resolve("assert")
} });
)
if (!config.plugins) config.plugins = [] if (!config.plugins) config.plugins = [];
config.plugins.push( config.plugins.push(
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env.ENV': JSON.stringify("prod"), 'process.env.ENV': JSON.stringify('prod'),
}) })
) );
config.plugins.push( config.plugins.push(
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({
process: 'process/browser.js', process: 'process/browser.js',
Buffer: ['buffer', 'Buffer'], Buffer: ['buffer', 'Buffer'],
})); })
);
if (!config.ignoreWarnings) config.ignoreWarnings = [] if (!config.ignoreWarnings) config.ignoreWarnings = [];
config.ignoreWarnings.push(/Failed to parse source map/) config.ignoreWarnings.push(/Failed to parse source map/);
return config; return config;
} },
}; };

View File

@ -37,9 +37,9 @@
"fix": "run-s fix:*", "fix": "run-s fix:*",
"test": "run-s build test:*", "test": "run-s build test:*",
"test:lint": "eslint src --ext .ts --ext .tsx", "test:lint": "eslint src --ext .ts --ext .tsx",
"test:prettier": "prettier \"src/**/*.{ts,tsx}\" \"./*.json\" --list-different", "test:prettier": "prettier \"src/**/*.{ts,tsx}\" \"./*.json\" \"./config/*.js\" --list-different",
"test:spelling": "cspell \"{README.md,.github/*.md,src/**/*.{ts,tsx},public/**/*.html}\" -c ../../.cspell.json", "test:spelling": "cspell \"{README.md,.github/*.md,src/**/*.{ts,tsx},public/**/*.html}\" -c ../../.cspell.json",
"fix:prettier": "prettier \"src/**/*.{ts,tsx}\" \"./*.json\" --write", "fix:prettier": "prettier \"src/**/*.{ts,tsx}\" \"./*.json\" \"./config/*.js\" --write",
"fix:lint": "eslint src --ext .ts --ext .tsx --fix", "fix:lint": "eslint src --ext .ts --ext .tsx --fix",
"proto": "run-s proto:*", "proto": "run-s proto:*",
"proto:build": "buf generate", "proto:build": "buf generate",