I copied the jet-start/webpack.config.js from the GitHub repo and I’m still getting:
ReferenceError: require is not defined
require jet.mjs:698
loadView jet.mjs:483
createFromURL jet.mjs:498
u jet.mjs:560
promise callbackrender jet.mjs:560
js portal.js:41
yi ready.js:40
$/< helpers.js:125
setTimeout handler$ helpers.js:123
ready.js:48
callEvent eventsystem.js:56
I customevents.js:7
xi ready.js:29
Ot htmlevents.js:42
ready.js:52
webix.min.js:9
webix.min.js:9
jet.mjs:547
Below is my webpack.config.js
var path = require("path");
var webpack = require("webpack");
module.exports = function(env) {
var pack = require("./package.json");
var MiniCssExtractPlugin = require("mini-css-extract-plugin");
var HtmlWebpackPlugin = require('html-webpack-plugin');
var production = !!(env && env.production === "true");
var asmodule = !!(env && env.module === "true");
var standalone = !!(env && env.standalone === "true");
var babelSettings = {
extends: path.join(__dirname, '/.babelrc')
};
var config = {
mode: production ? "production" : "development",
entry: {
myapp: "./sources/portal.js",
login: "./sources/views/login.js"
},
output: {
path: path.join(__dirname, "./public/bundles"),
publicPath:"/",
filename: "[name].js",
chunkFilename: "[name].bundle.js",
clean: {
keep: /public\//,
}
},
module: {
rules: [
{
test: /\.(js)$/,
exclude: /webix\.(min\.|)js$/,
use: "babel-loader?" + JSON.stringify(babelSettings)
},
{
test: /webix\.(min\.|)js$/,
use: "script-loader"
},
{
test: /\.(svg|png|jpg|gif)$/,
use: "url-loader?limit=25000"
},
{
test: /\.(less|css)$/,
use: [ MiniCssExtractPlugin.loader, "css-loader", "less-loader" ]
}
]
},
stats:"minimal",
resolve: {
extensions: [".js"],
modules: ["./sources", "node_modules"],
alias:{
"webix":path.resolve(__dirname, "node_modules", "webix", "webix.min.js"),
"jet-views":path.resolve(__dirname, "sources/views"),
"jet-locales":path.resolve(__dirname, "sources/locales")
}
},
plugins: [
new MiniCssExtractPlugin({
filename:"[name].css"
}),
new webpack.DefinePlugin({
VERSION: `"${pack.version}"`,
APPNAME: `"${pack.name}"`,
PRODUCTION : production,
BUILD_AS_MODULE : (asmodule || standalone)
}),
new HtmlWebpackPlugin({ title: 'Employee Portal', template: 'template.html' }),
],
//devtool: "inline-source-map",
devServer: {
open: true,
hot: true,
static: './public',
host: '192.168.2.50',
port: '5555',
headers: {
'Access-Control-Allow-Origin': '*'
},
proxy: [{
context: ['/api/*'],
target: 'http://192.168.2.50:8001',
changeOrigin: true,
secure: false
},
{
context: ['/auth'],
target: 'http://192.168.2.50:8001',
changeOrigin: true,
secure: false
},
{
context: ['/unlock/*'],
target: 'http://192.168.2.50:8001',
changeOrigin: true,
secure: false
}]
},
};
if (!production){
config.devtool = "inline-source-map";
}
if (asmodule){
if (!standalone){
config.externals = config.externals || {};
config.externals = [ "webix-jet" ];
}
const out = config.output;
const sub = standalone ? "full" : "module";
out.library = pack.name.replace(/[^a-z0-9]/gi, "");
out.libraryTarget= "umd";
out.path = path.join(__dirname, "dist", sub);
out.publicPath = "/dist/"+sub+"/";
}
return config;
}