Skip to content

Commit

Permalink
Merge pull request #1330 from stof/add_internal_types
Browse files Browse the repository at this point in the history
Add some types in the internal implementation of Encore
  • Loading branch information
stof authored Sep 6, 2024
2 parents 1a5e2f8 + 12c8144 commit 1d49c5d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/config-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ class ConfigGenerator {
this.webpackConfig.runtimeConfig.devServerFinalIsHttps = false;
}

/**
* @type {import('webpack').Configuration}
*/
const config = {
context: this.webpackConfig.getContext(),
entry: this.buildEntryConfig(),
Expand Down Expand Up @@ -158,6 +161,9 @@ class ConfigGenerator {
}

buildEntryConfig() {
/**
* @type {Record<string, string[]>}
*/
const entry = {};

for (const [entryName, entryChunks] of this.webpackConfig.entries) {
Expand Down Expand Up @@ -544,7 +550,7 @@ class ConfigGenerator {
}

if (this.webpackConfig.shouldUseSingleRuntimeChunk) {
optimization.runtimeChunk = 'single';
optimization.runtimeChunk = /** @type {const} */ ('single');
}

optimization.splitChunks = applyOptionsCallback(
Expand All @@ -558,7 +564,7 @@ class ConfigGenerator {
buildCacheConfig() {
const cache = {};

cache.type = 'filesystem';
cache.type = /** @type {const} */ ('filesystem');
cache.buildDependencies = this.webpackConfig.persistentCacheBuildDependencies;

applyOptionsCallback(
Expand Down
3 changes: 3 additions & 0 deletions lib/loaders/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ module.exports = {
getLoaders(webpackConfig, useCssModules = false) {
const usePostCssLoader = webpackConfig.usePostCssLoader;

/**
* @type {boolean|object}
*/
let modulesConfig = false;
if (useCssModules) {
modulesConfig = {
Expand Down

0 comments on commit 1d49c5d

Please sign in to comment.