|
@@ -6,6 +6,12 @@ const CleanWebpackPlugin = require("clean-webpack-plugin");
|
|
|
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
|
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
|
|
const webpack = require("webpack");
|
|
const webpack = require("webpack");
|
|
|
|
|
|
|
|
|
|
+function getCurrentProjectname() {
|
|
|
|
|
+ let pathSplit = __dirname.split(path.sep);
|
|
|
|
|
+
|
|
|
|
|
+ return pathSplit[pathSplit.length - 1];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
module.exports = {
|
|
module.exports = {
|
|
|
plugins: [
|
|
plugins: [
|
|
|
new CleanWebpackPlugin(),
|
|
new CleanWebpackPlugin(),
|
|
@@ -13,12 +19,14 @@ module.exports = {
|
|
|
{
|
|
{
|
|
|
template: "./ui/frontend/errors_template.tpl",
|
|
template: "./ui/frontend/errors_template.tpl",
|
|
|
filename: path.resolve(__dirname, './ui/frontend/errors.tpl'),
|
|
filename: path.resolve(__dirname, './ui/frontend/errors.tpl'),
|
|
|
|
|
+ chunks: ["frontend"]
|
|
|
}
|
|
}
|
|
|
),
|
|
),
|
|
|
new HtmlPlugin(
|
|
new HtmlPlugin(
|
|
|
{
|
|
{
|
|
|
template: "./ui/frontend/masterpage_template.tpl",
|
|
template: "./ui/frontend/masterpage_template.tpl",
|
|
|
filename: path.resolve(__dirname, './ui/frontend/masterpage.tpl'),
|
|
filename: path.resolve(__dirname, './ui/frontend/masterpage.tpl'),
|
|
|
|
|
+ chunks: ["frontend"]
|
|
|
}
|
|
}
|
|
|
),
|
|
),
|
|
|
new MiniCssExtractPlugin({filename: "styles.[contenthash].css"}),
|
|
new MiniCssExtractPlugin({filename: "styles.[contenthash].css"}),
|
|
@@ -56,10 +64,12 @@ module.exports = {
|
|
|
)
|
|
)
|
|
|
],
|
|
],
|
|
|
},
|
|
},
|
|
|
- entry: "./ui/frontend/js/index.js",
|
|
|
|
|
|
|
+ entry: {
|
|
|
|
|
+ "frontend": "./ui/frontend/js/frontend.js"
|
|
|
|
|
+ },
|
|
|
output: {
|
|
output: {
|
|
|
- publicPath: '/' + process.env.npm_package_projectname + '/assets/frontend/',
|
|
|
|
|
|
|
+ publicPath: '/' + getCurrentProjectname() + '/assets/frontend/',
|
|
|
path: path.resolve(__dirname, "assets/frontend/"),
|
|
path: path.resolve(__dirname, "assets/frontend/"),
|
|
|
- filename: "bundle.[contenthash].js"
|
|
|
|
|
|
|
+ filename: "[name].[contenthash].js"
|
|
|
},
|
|
},
|
|
|
};
|
|
};
|