Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
config.output = {
path: root('dist'),
publicPath: isProd ? 'ng-select' : 'http://localhost:8080/',
filename: isProd ? 'js/[name].[hash].js' : 'js/[name].js',
chunkFilename: isProd ? '[id].[hash].chunk.js' : '[id].chunk.js'
};
/**
* Resolve
* Reference: http://webpack.github.io/docs/configuration.html#resolve
*/
config.resolve = {
// only discover files that have those extensions
extensions: ['.ts', '.js', '.json', '.css', '.scss', '.html'],
plugins: [
new TsConfigPathsPlugin({
configFileName: './demo/tsconfig.json',
compiler: 'typescript'
})
]
};
/**
* Loaders
* Reference: http://webpack.github.io/docs/configuration.html#module-loaders
* List: http://webpack.github.io/docs/list-of-loaders.html
* This handles most of the magic responsible for converting modules
*/
config.module = {
rules: [
// Support for .ts files.
{
},
'react-dom': {
commonjs: 'react-dom',
commonjs2: 'react',
amd: 'react-dom',
root: 'ReactDOM',
},
},
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false,
}),
new TsConfigPathsPlugin(),
new CheckerPlugin(),
new CaseSensitivePathsPlugin(),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
// eslint-disable-next-line camelcase
screw_ie8: true,
warnings: false,
},
mangle: {
'.js',
'.json',
'.jsx',
'.ts',
'.tsx',
],
alias: {
'@babel/runtime': dirname(
require.resolve('@babel/runtime/package.json'),
),
...opts.alias,
},
plugins:
process.env.TS_CONFIG_PATHS_PLUGIN &&
process.env.TS_CONFIG_PATHS_PLUGIN !== 'none'
? [new TsConfigPathsPlugin()]
: [],
},
module: {
rules: [
...(process.env.DISABLE_TSLINT || process.env.TSLINT === 'none'
? []
: [
{
test: /\.tsx?$/,
include: opts.cwd,
exclude: /node_modules/,
enforce: 'pre',
use: [
{
options: {
emitErrors: true,
devtool: isProd ? 'source-map' : 'eval-source-map',
mode: isProd ? 'production' : 'development',
entry: {
'polyfills': './demo/polyfills.ts',
'app': './demo/main.ts',
},
output: {
path: root('dist'),
publicPath: isProd ? 'ng-select' : 'http://localhost:8080/',
filename: isProd ? 'js/[name].[hash].js' : 'js/[name].js',
chunkFilename: isProd ? '[id].[hash].chunk.js' : '[id].chunk.js'
},
resolve: {
extensions: ['.ts', '.js', '.json', '.css', '.scss', '.html'],
plugins: [
new TsConfigPathsPlugin({
configFileName: './demo/tsconfig.json',
compiler: 'typescript'
})
]
},
module: {
rules: [
{
test: /\.ts$/,
loader: ['awesome-typescript-loader?configFileName=./demo/tsconfig.json', 'angular2-template-loader', 'ng-snippets-loader'],
exclude: [/\.(spec|e2e)\.ts$/, /node_modules\/(?!(ng2-.+))/],
},
{
test: /\.ts$/,
enforce: 'pre',
}]),
isProd ? new UglifyJsPlugin({
mangle: {
screw_ie8 : true,
}, //prod
compress: { //prod
screw_ie8: true,
warnings: false
},
sourceMap: true,
comments: false //prod
}) : null
].filter(plugin=>plugin!==null),
resolve: {
extensions: ['.ts', '.js', '.json'],
plugins: [ new TsConfigPathsPlugin() ]
},
devServer: {
contentBase: './app/public',
host: '0.0.0.0',
port: PORT,
hot: HMR,
inline: HMR,
historyApiFallback: true
},
node: {
global: true,
process: true,
Buffer: false,
crypto: 'empty',
module: false,
clearImmediate: false,
},
{
test: /\.(png|jp(e*)g)$/,
use: {
loader: 'url-loader',
options: {
limit: 8000,
},
},
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
plugins: [
new TsConfigPathsPlugin(),
],
},
plugins: [
new webpack.DefinePlugin({
VERSION: JSON.stringify(pkg.version),
}),
new webpack.BannerPlugin(`indigo-player v${pkg.version} - [name] - ${+new Date()}`),
],
optimization: {
splitChunks: {
chunks: 'async',
cacheGroups: {
vendors: false,
},
},
minimizer: [],