Skip to content

Commit f8461d3

Browse files
committed
adding anotehr faq for old packages without a main script
1 parent f5c22a6 commit f8461d3

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Diff for: frontend/encore/faq.rst

+27
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,30 @@ Uncaught ReferenceError: webpackJsonp is not defined
5151
If you get this error, it's probably because you've just added a :doc:`shared entry </frontend/encore/shared-entry>`
5252
but you *forgot* to add a ``script`` tag for the new ``manifest.js`` file. See the
5353
information about the :ref:`script tags <encore-shared-entry-script>` in that section.
54+
55+
This dependency was not found: some-module in ./path/to/file.js
56+
---------------------------------------------------------------
57+
58+
Usually, after you install a package via yarn, you can require / import it to use
59+
it. For example, after running ``yarn add respond.js``, you try to require that module:
60+
61+
.. code-block:: javascript
62+
63+
require('respond.js');
64+
65+
But, instead of working, you see an error:
66+
67+
This dependency was not found:
68+
69+
* respond.js in ./app/Resources/assets/js/app.js
70+
71+
Typically, a package will "advertise" its "main" file by adding a ``main`` key to
72+
its ``package.json``. But sometimes, old libraries won't have this. Instead, you'll
73+
need to specifically require the file you need. In this case, the file you should
74+
use is located at ``node_modules/respond.js/dest/respond.src.js``. You can require
75+
this via:
76+
77+
.. code-block:: javascript
78+
79+
// require a non-minified file whenever possible
80+
require('respond.js/dest/respond.src.js');

0 commit comments

Comments
 (0)