Refactor to remove code coupling with Webpack
Remove using Webpack import syntax such as: `js-yaml-loader!@/..`. It's a non-standard syntax that couples the code to Webpack. Configure instead by specifying Webpack loader in Vue configuration file. Enable related ESLint rules. Remove unused dependency `raw-loader` and refactor `NoUnintendedInlining` test to load files using file system (dropping webpack dependency). Refactor to use `import type` for type imports to show the indent clearly and satisfy failing ESLint rules.
This commit is contained in:
@@ -8,6 +8,7 @@ module.exports = defineConfig({
|
||||
transpileDependencies: true,
|
||||
chainWebpack: (config) => {
|
||||
changeAppEntryPoint('./src/presentation/main.ts', config);
|
||||
addWebpackRule('yaml', /\.ya?ml$/, 'js-yaml-loader', config);
|
||||
},
|
||||
configureWebpack: {
|
||||
resolve: {
|
||||
@@ -51,6 +52,15 @@ module.exports = defineConfig({
|
||||
},
|
||||
});
|
||||
|
||||
function addWebpackRule(name, test, loader, config) {
|
||||
config.module
|
||||
.rule(name)
|
||||
.test(test)
|
||||
.use(loader)
|
||||
.loader(loader)
|
||||
.end();
|
||||
}
|
||||
|
||||
function changeAppEntryPoint(entryPath, config) {
|
||||
config.entry('app').clear().add(entryPath).end();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user