Created
October 26, 2019 19:55
-
-
Save shobishani/f2aee0b2f99ec6bf02d4a5143c3507ab to your computer and use it in GitHub Desktop.
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 { CheckerPlugin } = require('awesome-typescript-loader'); | |
const CopyWebpackPlugin = require('copy-webpack-plugin'); | |
const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
const path = require('path'); | |
const { | |
NamedModulesPlugin, | |
} = require('webpack'); | |
const { | |
GENERAL, | |
PATHS, | |
} = require('../../settings'); | |
module.exports = { | |
entry: { | |
app: [ | |
'babel-polyfill', | |
PATHS.entry, | |
] | |
}, | |
resolve: { | |
extensions: [ '.ts', '.tsx', '.js', '.scss', '.css' ], | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.tsx?$/, | |
exclude: /node_modules/, | |
use: [ | |
{ | |
loader: 'awesome-typescript-loader', | |
options: { | |
configFileName: PATHS.configs.tsconfig, | |
forceIsolatedModules: true, | |
useBabel: true, | |
useCache: true, | |
cacheDirectory: path.join(PATHS.cache, 'awesome-typescript-loader'), | |
} | |
}, | |
], | |
}, | |
{ | |
test: /\.(png|gif|jpg|cur)$/, | |
loader: 'url-loader', | |
query: { | |
limit: 8192, | |
publicPath: '/', | |
}, | |
}, | |
{ | |
test: /\.woff2(\?v=[0-9]\.[0-9]\.[0-9])?$/, | |
loader: 'url-loader', | |
query: { | |
limit: 10000, | |
mimetype: 'application/font-woff2', | |
publicPath: '/', | |
}, | |
}, | |
{ | |
test: /\.woff(\?v=[0-9]\.[0-9]\.[0-9])?$/, | |
loader: 'url-loader', | |
query: { | |
limit: 10000, | |
mimetype: 'application/font-woff', | |
publicPath: '/', | |
}, | |
}, | |
{ | |
test: /\.(ttf|eot|svg|otf)(\?v=[0-9]\.[0-9]\.[0-9])?$/, | |
loader: 'file-loader', | |
query: { | |
publicPath: '/', | |
}, | |
}, | |
], | |
}, | |
plugins: [ | |
new NamedModulesPlugin(), | |
new CheckerPlugin(), | |
new CopyWebpackPlugin([ | |
{ | |
context: PATHS.assets, | |
from: '**/*', | |
to: 'assets/', | |
} | |
]), | |
], | |
target: 'web', | |
output: { | |
path: PATHS.static, | |
filename: '[name].[hash].js', | |
publicPath: '/static/', | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment