fix plugin frontend build

This commit is contained in:
Sebastian Sdorra
2019-10-21 14:52:08 +02:00
parent 2de369b929
commit bdb4bb73ac
6 changed files with 14 additions and 30 deletions

View File

@@ -3,7 +3,7 @@
"private": true,
"version": "2.0.0-SNAPSHOT",
"license": "BSD-3-Clause",
"main": "src/main/js/index.js",
"main": "./src/main/js/index.ts",
"scripts": {
"build": "ui-scripts plugin",
"watch": "ui-scripts plugin-watch",

View File

@@ -3,7 +3,7 @@
"private": true,
"version": "2.0.0-SNAPSHOT",
"license": "BSD-3-Clause",
"main": "src/main/js/index.js",
"main": "./src/main/js/index.ts",
"scripts": {
"build": "ui-scripts plugin",
"watch": "ui-scripts plugin-watch",

View File

@@ -3,7 +3,7 @@
"private": true,
"version": "2.0.0-SNAPSHOT",
"license": "BSD-3-Clause",
"main": "src/main/js/index.js",
"main": "./src/main/js/index.tsx",
"scripts": {
"build": "ui-scripts plugin",
"watch": "ui-scripts plugin-watch",

View File

@@ -3,7 +3,7 @@
"private": true,
"version": "2.0.0-SNAPSHOT",
"license": "BSD-3-Clause",
"main": "src/main/js/index.js",
"main": "./src/main/js/index.ts",
"scripts": {
"build": "ui-scripts plugin",
"watch": "ui-scripts plugin-watch",

View File

@@ -4,9 +4,7 @@ const fs = require("fs");
const root = process.cwd();
const packageJsonPath = path.join(root, "package.json");
const packageJSON = JSON.parse(
fs.readFileSync(packageJsonPath, { encoding: "UTF-8" })
);
const packageJSON = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: "UTF-8" }));
let name = packageJSON.name;
const orgaIndex = name.indexOf("/");
@@ -18,7 +16,7 @@ module.exports = function(mode) {
return {
context: root,
entry: {
[name]: "./src/main/js/index.js"
[name]: packageJSON.main || "src/main/js/index.js"
},
mode,
devtool: "source-map",
@@ -45,7 +43,7 @@ module.exports = function(mode) {
module: {
rules: [
{
test: /\.(js|jsx)$/,
test: /\.(js|ts|jsx|tsx)$/i,
exclude: /node_modules/,
use: {
loader: "babel-loader",
@@ -64,14 +62,11 @@ module.exports = function(mode) {
}
]
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx", ".css", ".scss", ".json"]
},
output: {
path: path.join(
root,
"target",
name + "-" + packageJSON.version,
"webapp",
"assets"
),
path: path.join(root, "target", name + "-" + packageJSON.version, "webapp", "assets"),
filename: "[name].bundle.js",
library: name,
libraryTarget: "amd"

View File

@@ -8,11 +8,7 @@ module.exports = [
{
context: root,
entry: {
webapp: [
"./ui-webapp/src/webpack-public-path.ts",
"./ui-styles/src/scm.scss",
"./ui-webapp/src/index.tsx"
]
webapp: ["./ui-webapp/src/webpack-public-path.ts", "./ui-styles/src/scm.scss", "./ui-webapp/src/index.tsx"]
},
devtool: "cheap-module-eval-source-map",
target: "web",
@@ -66,9 +62,7 @@ module.exports = [
]
},
resolve: {
extensions: [
".ts", ".tsx", ".js", ".jsx", ".css", ".scss", ".json"
]
extensions: [".ts", ".tsx", ".js", ".jsx", ".css", ".scss", ".json"]
},
output: {
path: path.join(root, "target", "assets"),
@@ -84,12 +78,7 @@ module.exports = [
app.use(createContextPathMiddleware("/scm"));
},
after: function(app) {
const templatePath = path.join(
root,
"ui-webapp",
"public",
"index.mustache"
);
const templatePath = path.join(root, "ui-webapp", "public", "index.mustache");
const renderParams = {
contextPath: "/scm"
};