Last active
April 26, 2023 12:59
-
-
Save majo44/e774abdc4aea027d11df1ee8582e97ee to your computer and use it in GitHub Desktop.
`resolve.extensionAlias` is not taking in account for the dynamic imports expressions evaluation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const x = 'a'; | |
import(`./lazy-${x}.js`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const msg = 'hello'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "untitled", | |
"version": "1.0.0", | |
"type": "module", | |
"scripts": { | |
"build": "webpack" | |
}, | |
"dependencies": { | |
"webpack": "5.80.0", | |
"webpack-cli": "5.0.2", | |
"ts-loader": "9.4.2", | |
"typescript": "5.0.4" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"module": "ESNext", | |
"target": "ESNext", | |
"sourceMap": true | |
}, | |
"exclude": [ | |
"node_modules" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { join, dirname } from 'node:path'; | |
import { fileURLToPath } from 'node:url'; | |
const __dirname = dirname(fileURLToPath(import.meta.url)); | |
const config = { | |
mode: 'development', | |
entry: './index.ts', | |
devtool: false, | |
output: { | |
path: join(__dirname, 'dist'), | |
publicPath: '/' | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.[t]sx?$/, | |
loader: 'ts-loader' | |
} | |
] | |
}, | |
resolve: { | |
extensions: [ '.ts', '.tsx', '.js', '.jsx' ], | |
extensionAlias: { | |
'.js': [ '.js', '.ts', '.tsx' ] | |
} | |
} | |
}; | |
export default config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment