Created
February 9, 2021 08:10
-
-
Save SirSerje/92ff56f503faf67f9d50461a4405087b to your computer and use it in GitHub Desktop.
Cant resolve aliases for Webpack with Typescript for React
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": { | |
"sourceMap": true, | |
"noImplicitAny": false, | |
"module": "commonjs", | |
"target": "es5", | |
"jsx": "react", | |
"allowJs": true, | |
"allowSyntheticDefaultImports": true, | |
"experimentalDecorators": true, | |
"esModuleInterop": true, | |
"declaration": true, | |
"rootDirs": ["src"], | |
"typeRoots": ["node_modules/@types"], | |
"types": ["node"], | |
"moduleResolution": "node", | |
"preserveConstEnums": true, | |
"removeComments": true, | |
"lib": [ | |
"es2019", | |
"dom" | |
] | |
}, | |
"baseUrl": "./", | |
"paths": { | |
"@admin/*": ["src/admin/*"], | |
"@components/*": ["src/app_mw/components/*"], | |
"@constants/*": ["src/app_mw/constants/*"], | |
}, | |
"include": ["src/*"], | |
"exclude": [ | |
"node_modules", | |
"build", | |
"swagger", | |
"test", | |
"docker" | |
], | |
} |
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
module.exports = { | |
entry: { | |
app: './src/app/index.tsx', | |
frontpage: './src/frontpage/index.jsx', | |
}, | |
resolve: { | |
alias: { | |
'@admin': path.resolve(__dirname, 'src/admin'), | |
'@components': path.resolve(__dirname, 'src/app/components'), | |
'@constants': path.resolve(__dirname, 'src/app/constants'), | |
}, | |
modules: [path.join(__dirname, 'src'), 'node_modules'], | |
extensions: ['.js', '.jsx', '.ts', '.tsx'], | |
}, | |
plugins, | |
output: { | |
path: `${__dirname}/build/`, | |
filename: 'name.js', | |
publicPath: '/static/', | |
}, | |
parallelism: 10, | |
module: { | |
rules: [ | |
{ test: /\.(png|jpg|gif)$/, use: [{ loader: 'url-loader', options: { limit: 10000 } }] }, | |
{ test: /\.(woff|woff2|ttf|eot)$/, use: [{ loader: 'url-loader', options: { limit: 10000 } }] }, | |
{ test: /\.svg$/, use: [{ loader: 'file-loader' }] }, | |
{ | |
test: /\.jsx?$/, | |
exclude: /(node_modules|build)/, | |
use: [ | |
'thread-loader', | |
{ loader: 'babel-loader'} | |
], | |
}, | |
{ | |
test: /\.(ts|tsx)$/, | |
exclude: /node_modules/, | |
use: [ | |
{ loader: 'thread-loader' }, | |
{ loader: 'babel-loader' }, | |
{ | |
loader: 'ts-loader', | |
options: { | |
happyPackMode: true, | |
} | |
}, | |
], | |
}, | |
], | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment