Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular example #405

Closed
danilolr opened this issue May 31, 2023 · 2 comments
Closed

Angular example #405

danilolr opened this issue May 31, 2023 · 2 comments

Comments

@danilolr
Copy link

I am trying to use Mind-Ar in a Angular 15 project.
Is there any example of this?

I found this issue #150 from @demisquare and I am trying to replicate.

I installed the libraries :

npm i mind-ar --save npm i aframe --save

I did this on my modules file:

`
import {CUSTOM_ELEMENTS_SCHEMA, NgModule} from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';

import 'mind-ar/dist/mindar-image.prod.js';
import 'aframe';
import 'mind-ar/dist/mindar-image-aframe.prod.js';

@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule
],
providers: [],
bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppModule { }
`

But I got this error on the browser console :

mind-ar-error

controller-939e6d85.js:55854 Uncaught ReferenceError: require is not defined at 7581 (controller-939e6d85.js:55854:1) at __webpack_require__ (bootstrap:19:1) at 6747 (app.component.html:434:34) at __webpack_require__ (bootstrap:19:1) at 4431 (app.module.ts:17:21) at __webpack_require__ (bootstrap:19:1) at __webpack_exec__ (main.ts:7:36) at main.ts:7:36 at __webpack_require__.O (chunk loaded:23:1) at main.ts:7:36

My example is on this public repository :

https://github.com/danilolr/mind-ar-angular-example

Can someone help me finish this example?

@demisquare
Copy link

Which version of mind-ar-js are you using? Some time ago I made this project with Angular 13 and mind-ar-ts (a TypeScript porting of mind-ar-js ) and it's working.

@demisquare
Copy link

demisquare commented May 31, 2023

Maybe it's cause Angular tries to retrieve Webpack somewhere but in the last version of mind-ar they don't use it anymore. Check #311 . Try to uninstall Webpack and install Vite in your project.

@hiukim hiukim closed this as completed Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants