Comments (2)
Thanks a ton @jamesgeorgewilliams. The solution you've provided above is working.
from joint.
This issue is not related to Angular
, but to Webpack
. Angular v8
is using Webpack v4
which can cause numerous issues.
Ideally, you would update your Angular project(v8
is not supported) to a version which uses Webpack v5
, but if that is not possible, you will have to try some alternatives below.
In your project, it's likely Webpack
cannot locate/recognize .mjs
files. To address this issue you have to update the Webpack
config.
If you have access to the webpack.config.js
file, you could add the following:
resolve: {
extensions: ['*', '.mjs', '.js', '.json']
},
module: {
rules: [
{
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto',
}
]
}
Additional Problem
If you have created your Angular 8
project with the angular cli, it's likely you don't have access to this config file as it is hidden from the user.
ng eject
is not available in Angular 8
(This was a command to expose the webpack.config.js
file). There is a package which allows you to create a custom webpack config without "ejecting" the angular cli project.
https://www.npmjs.com/package/@angular-builders/custom-webpack
It can be added to your project via npm i @angular-builders/[email protected] -D
This will allow you to create a webpack configuration in the angular.json
file. You have to update the build
and serve
sections as follows:
"architect": {
...
"build": {
"builder": "@angular-builders/custom-webpack:browser"
"options": {
"customWebpackConfig": {
"path": "./extra-webpack.config.js",
"mergeStrategies": {
"externals": "replace"
}
...
}
},
...
"serve": {
"builder": "@angular-builders/custom-webpack:dev-server",
},
}
You can find more information at the following link.
https://github.com/just-jeb/angular-builders/blob/8.x.x/packages/custom-webpack/README.md
Now, you should create the webpack config file extra-webpack.config.js
in the root of your project. It can contain the following:
module.exports = {
mode: 'production', // "production" | "development" | "none"
resolve: {
extensions: ['*', '.mjs', '.js', '.json']
},
module: {
rules: [
{
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto'
}
]
}
};
At this point, if you run npm run start
, the errors in your screenshot above should be fixed, but you will have some new errors related to some JavaScript features.
Webpack v4
doesn't support newer JavaScript features, es2020
for example.
You should add some babel
packages to your project to support this, and update the extra-webpack.config.js
.
npm i [email protected] -D
npm i @babel/plugin-proposal-nullish-coalescing-operator -D
extra-webpack.config.js
module.exports = {
mode: 'production', // "production" | "development" | "none"
resolve: {
extensions: ['*', '.mjs', '.js', '.json']
},
module: {
rules: [
{
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto',
use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', { targets: "defaults" }]
],
plugins: ['@babel/plugin-proposal-nullish-coalescing-operator']
}
}
}
]
}
};
Running npm run start
should be successful now. As mentioned above, ideally you would just update to a supported version of Angular that uses webpack v5
if possible as it would solve all of these issues.
from joint.
Related Issues (20)
- [Bug]: Using graph.findModelsUnderElement(cell) with lables positioned outside the rectangle cell
- [Bug]:Jointjs+ Navigator
- Issue with JointJS in Typescript when integrated in own project
- [Bug]: Ports positioning in jointJS with angular HOT 1
- Vectorizer: can not convert zero-length arc to curve HOT 1
- [Bug]: Angular 17, Builder Application or Esbuild, does not provide an export named "dia" HOT 2
- SVG's height is overlapped by uikit.js HOT 3
- type(ui.Toolbar): wrong `widgetNamespace` type HOT 1
- [Bug]: Migration to joinjts 4.0 Not loading cells HOT 9
- Stencil Label not rendering HOT 1
- [Bug]: renderFieldContent Function Not Working as Expected HOT 2
- [Bug]: Each object assigned to portProp makes the diagram slower to render HOT 1
- link touch another link HOT 4
- [Bug]: Unsupported URL Type "workspace on @joint/[email protected] HOT 1
- Unable to get Selectors to animate my Customized Link HOT 2
- Rendering issue when paper is loaded in background. HOT 1
- [Bug]: Grid-layer display only one when two or more papers exist at the same time
- [Bug]: contextmenu in V4 is not default-preventable HOT 9
- [Bug]: JJ+ stopped rendering CSS when exporting to PNG (possibly other formats too) HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from joint.