Bundling JET code with Webpack ============================== This plugin should be used when using Webpack to bundle JET modules. It should be used if you are trying to generate Web-pack-specific bundles and not if you are planning to generate AMD modules and use Require.js at runtime. These tools require JET 6.0 or newer. Refer to the enclosed webpack.config.js for typical configuration. There are two main pieces involved in getting JET to 'play nicely' with Webpack: 1. ojL10n-loader - this is a build-time replacement for JET's ojL10n Require.js plugin. It assumes that the Webpack bundle is being generated for a particular locale (en-CA, fr-CA, fr-FR, etc.). The locale has to be provided as loader 'locale' option in webpack.config.js. If none is provided, the loader will generate a bundle for en-US. 2. WebpackRequireFixupPlugin - a plugin that resolves issues with JET features that are problematic for Webpack. It performs build-time code modifications to eliminate the need to use Require.js at runtime while preserving all JET functionality including the lazily loaded module (ojModule and ). ojModules and elements with global vs. relative paths ================================================================= The instructions below provide different recommendations for ojModules and elements with global vs relative paths. If you are unsure what type of module you are using, just check whether you are specifying the require instance in ojModule config or in the ModuleElementUtils.createView/createViewModel. Without the require instance, views and viewModels will be loaded relative to what Require.js sees as application's baseUrl. i.e. globally to the entire application. With the require instance, views and viewModels will be loaded relative to the module that provided that require instance. Loading with a relative path is normally used when ojModule is used in a composite component (see the Cookbook sample 'ojModule->Embedding in a Composite'). Instructions: ============== By default, the webpack.config.js is configured to run, as is, when unzipped into the root of an application generated using the ojet-cli tooling. To run Webpack against a JET Starter Template, follow these steps. 1) Create new JET app with: ojet create myWebPackTest --template=navdrawer 2) Build the JET app with "ojet build" 3) Unzip the jet-webpack.zip file into the root of the new application 4) From the root of your application, install three libraries npm i webpack webpack-cli text-loader --save-dev 5) Run "npx webpack" from the root of the project These five steps will allow you to package the starter template application using Webpack. The default will produce a "bundle.js" file in the /web directory. To use this as the basis of your application, change the