replaced Grunt with Webpack as front-end build tool
This commit is contained in:
parent
36ddba24ad
commit
2e133d2b9c
16 changed files with 222 additions and 481 deletions
|
@ -5,7 +5,7 @@ var config = {
|
|||
entry: "./static/js/main.ts",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "static/build"),
|
||||
filename: "bundle.js"
|
||||
filename: "quay-frontend.js"
|
||||
},
|
||||
resolve: {
|
||||
extensions: [".ts", ".tsx", ".js", ".scss"],
|
||||
|
@ -13,10 +13,10 @@ var config = {
|
|||
sass: path.resolve(__dirname, 'static/css/directives/components/pages/')
|
||||
}
|
||||
},
|
||||
// Use window.angular to maintain compatibility with non-Webpack components
|
||||
// Use global variables to maintain compatibility with non-Webpack components
|
||||
externals: {
|
||||
angular: "angular",
|
||||
jquery: "$"
|
||||
jquery: "$",
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
|
@ -31,13 +31,43 @@ var config = {
|
|||
test: /\.s?css$/,
|
||||
use: [
|
||||
"style-loader",
|
||||
"css-loader",
|
||||
"css-loader?minimize=true",
|
||||
"sass-loader",
|
||||
],
|
||||
},
|
||||
{
|
||||
test: /\.html$/,
|
||||
use: [
|
||||
'ngtemplate-loader?relativeTo=' + (path.resolve(__dirname)),
|
||||
'html-loader',
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
devtool: "source-map",
|
||||
plugins: [
|
||||
// Replace references to global variables with associated modules
|
||||
new webpack.ProvidePlugin({
|
||||
ZeroClipboard: 'zeroclipboard',
|
||||
FileSaver: 'file-saver',
|
||||
angular: "angular",
|
||||
$: "jquery",
|
||||
}),
|
||||
],
|
||||
devtool: "cheap-module-source-map",
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = config;
|
||||
|
|
Reference in a new issue