Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

Symfony7 Metronic 8.2.5 AssetMapper - TypeError:Cannot set properties of undefined (setting ‘moment’)


As I mentioned in a previous query, I'm working with Symfony7 and in the latest updates (since Symfony 6.3) AssetMapper is recommended over Webpack. Given the problems I'm having with Metronic 8 in Symfony 7, I've been testing with AssetMapper and in principle everything starts to work (at least apparently). Setting up AssetMapper is quite easy and you only have to import the different .js in the app.js file. However, I get a problem with the "plugins.bundle.js" in the console. It says: "TyperError: Cannot set properties of undefined (setting 'moment')". I've seen in the comments about it that it would be solved with webpack, but I'm trying to avoid webpack and make the application lighter, how can it be solved.

How can I solve the problem, is it necessary to import and call some library that is not included in the asset folder of the demo?

Thanks.


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)


Hi Restituto Vaño,

Here are some steps you can try:

Please copy plugins.bundle.js from the HTML version demo1, into your Symfony project. Let's see if the plugin file works.

Try to rebuild assets with webpack. Inside the folder symfony/starterkit/_keenthemes/tools, run these commands:

npm install
npm run build


The file symfony/starterkit/public/assets/plugins/global/plugins.bundle.js will be regenerated. Try to use it with your AssetMapper

Thank you


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(