2016-09-27 18:06:28 +00:00
|
|
|
var webpack = require('webpack');
|
|
|
|
var path = require("path");
|
|
|
|
|
|
|
|
var config = {
|
2017-04-05 21:14:08 +00:00
|
|
|
entry: "./static/js/main.ts",
|
2016-09-27 18:06:28 +00:00
|
|
|
output: {
|
2017-01-24 22:05:06 +00:00
|
|
|
path: path.resolve(__dirname, "static/build"),
|
2017-06-13 20:07:46 +00:00
|
|
|
filename: 'quay-frontend.js'
|
2016-09-27 18:06:28 +00:00
|
|
|
},
|
|
|
|
resolve: {
|
2017-02-06 22:05:19 +00:00
|
|
|
extensions: [".ts", ".tsx", ".js", ".scss"],
|
2016-11-07 22:27:50 +00:00
|
|
|
alias: {
|
2017-02-06 22:05:19 +00:00
|
|
|
sass: path.resolve(__dirname, 'static/css/directives/components/pages/')
|
2016-11-07 22:27:50 +00:00
|
|
|
}
|
2016-09-27 18:06:28 +00:00
|
|
|
},
|
2017-05-21 09:10:11 +00:00
|
|
|
// Use global variables to maintain compatibility with non-Webpack components
|
2017-01-19 08:53:38 +00:00
|
|
|
externals: {
|
2017-02-06 22:05:19 +00:00
|
|
|
angular: "angular",
|
2017-05-21 09:10:11 +00:00
|
|
|
jquery: "$",
|
2017-01-19 08:53:38 +00:00
|
|
|
},
|
2016-09-27 18:06:28 +00:00
|
|
|
module: {
|
2017-02-06 22:05:19 +00:00
|
|
|
rules: [
|
2016-09-27 18:06:28 +00:00
|
|
|
{
|
2017-06-20 06:17:42 +00:00
|
|
|
test: /\.ts?$/,
|
2017-05-25 04:42:06 +00:00
|
|
|
use: ["ts-loader"],
|
2016-09-27 18:06:28 +00:00
|
|
|
exclude: /node_modules/
|
2016-11-02 18:15:52 +00:00
|
|
|
},
|
2017-01-18 23:46:37 +00:00
|
|
|
{
|
2017-06-07 19:54:43 +00:00
|
|
|
test: /\.css$/,
|
2017-02-06 22:05:19 +00:00
|
|
|
use: [
|
|
|
|
"style-loader",
|
2017-05-21 09:10:11 +00:00
|
|
|
"css-loader?minimize=true",
|
2017-02-06 22:05:19 +00:00
|
|
|
],
|
2017-01-19 08:53:38 +00:00
|
|
|
},
|
2017-05-21 09:10:11 +00:00
|
|
|
{
|
|
|
|
test: /\.html$/,
|
|
|
|
use: [
|
|
|
|
'ngtemplate-loader?relativeTo=' + (path.resolve(__dirname)),
|
|
|
|
'html-loader',
|
|
|
|
]
|
2017-05-25 04:42:06 +00:00
|
|
|
},
|
2016-09-27 18:06:28 +00:00
|
|
|
]
|
2017-01-18 23:46:37 +00:00
|
|
|
},
|
2017-05-21 09:10:11 +00:00
|
|
|
plugins: [
|
|
|
|
// Replace references to global variables with associated modules
|
|
|
|
new webpack.ProvidePlugin({
|
|
|
|
FileSaver: 'file-saver',
|
|
|
|
angular: "angular",
|
|
|
|
$: "jquery",
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
devtool: "cheap-module-source-map",
|
2016-09-27 18:06:28 +00:00
|
|
|
};
|
|
|
|
|
2017-05-21 09:10:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Production settings
|
|
|
|
*/
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
|
|
config.plugins.push(
|
|
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
|
|
sourceMap: true,
|
|
|
|
// Disable mangle to prevent AngularJS errors
|
|
|
|
mangle: false
|
|
|
|
})
|
|
|
|
);
|
2017-06-13 20:07:46 +00:00
|
|
|
config.output.filename = 'quay-frontend-[hash].js';
|
2017-05-21 09:10:11 +00:00
|
|
|
}
|
|
|
|
|
2016-09-27 18:06:28 +00:00
|
|
|
module.exports = config;
|