Code: Select all
yLibrary.showAlert()
Beispiel: < /p>
Code: Select all
//alerts.js
export function showAlert() {
console.log("show alert called");
}
//translations.js
export function translateText() {
console.log("translate text called");
}
//main.js
import "./components/alerts.js";
import "./components/translations.js";
//Note: I want to avoid this part
export * from "/components/alerts.js";
export * from "/components/translations.js";
//webpack.library.config.js
const path = require("path");
const libraryName = "rmsui";
var configLib = Object.assign({}, config, {
mode: "development",
name: "myLibrary",
entry: {
// JS
myLibrary: "./js/main.js",
errorPages: "./js/errorPages.js" //some other entrypoint not shown above
},
output: {
path: path.resolve(__dirname, "./wwwroot/dist"),
filename: "js/[name].js",
globalObject: "this",
library: {
name: libraryName,
type: "umd",
},
libraryTarget: "var",
//umdNamedDefine: true,
assetModuleFilename: "assets/[hash][ext][query]"
},
plugins: [
//new CleanWebpackPlugin(),
new MiniCssExtractPlugin({
filename: "css/[name].css"
})
]
});
module.exports = configLib;