Closed OasisOfChaos closed 7 years ago
Just referencing a directory won't include its files. You need to import the actual .js
files into your application. For example, in boot-client.ts
,
import '../../some/directory/file.js';
Make sure that works before trying to put them in your vendor bundle.
@SteveSandersonMS So just to be clear here. If I have a random TS file (living in wwwroot
let's say) I want to include with the site (code written against a jQuery plugin) I just import the file into my boot-client.ts
? I don't need to then do anything with webpack
or any other integration?
Thanks!
If I have a random TS file (living in wwwrootlet's say)
Preferably don't put .ts
files in wwwroot
, because then you'll deploy them to production and make them world-readable.
I just import the file into my boot-client.ts? I don't need to then do anything with webpackor any other integration?
Importing the file will cause it to be included in the bundle, and its code will be evaluated when your page starts up. Whether evaluating the code does what you want depends on what the code is and what you want it to do :)
Does anyone know the best way to add a new directory (relative to the root) for jquery plugins? I am trying to add some css/js from a plugin that has no npm package and now webpack cannot find the files when I try to add them to the vendor bundle. I've tried to add an alias in the webpack.config.vendor.js file but webpack still cannot find them. My files are in
/libs
(at the same level asnode_modules
).Is there any recommended (better) way to do this? I'm still pretty new to all of this...
my webpack.config.vendor.js:
When I run webpack --config webpack.config.vendor.js:
Thanks!