Oct 9, 2017
2
Level 4
Accessing Compiled Javascript Assets from Blade Templates
Trying to access the "d3" library, but pulling it in through npm and adding it as a dependency to a compiled file that is already bundling together some similar functionality. To the asset js file I added the line:
var d3 = require("d3");
and judging by the size increase in the compiled js file it looks like it pulls in successfully. Now I'm sure I could do "d3. ..." stuff in the asset js file, but what I want to do is use d3 in blocks down in later blade templates.
If I pull in a d3 file "the old way" by adding a "" line I can use d3 in script blocks later on the page.
If I pull in the compiled file by adding a "" line I think the code is there, but d3 is not defined.
Please or to participate in this conversation.