Skip to content

Instantly share code, notes, and snippets.

@alonstar
Last active February 6, 2018 06:45
Show Gist options
  • Save alonstar/5207826de69df256cd82fd60e7b91959 to your computer and use it in GitHub Desktop.
Save alonstar/5207826de69df256cd82fd60e7b91959 to your computer and use it in GitHub Desktop.
Webpack for ASP.NET CORE
const path = require('path');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const webpack = require('webpack');
//const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: {
main: "./Scripts/main.ts",
hub: "./Scripts/hub.ts"
},
output: {
publicPath: "/js/",
path: path.join(__dirname, '/wwwroot/js/'),
filename: '[name].build.js'
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx']
},
devtool: 'source-map',
module: {
loaders: [
// all files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'
{ test: /\.tsx?$/, loader: "awesome-typescript-loader" },
//{
// test: /\.scss$/,
// use: extractPlugin.extract({
// use: ['css-loader', 'sass-loader']
// })
//}
]
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
Popper: ['popper.js', 'default']
}),
new UglifyJsPlugin()
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment