Built to support multiple applications
-
Install NPM in the project root folder
npm install
-
If you're not satisfied with the current
package.json
- Create the
package.json
, and follow the instructions after entering the commandnpm init
- Install rollup using
npm install rollup --save-dev
- Install babel using
npm install @babel/core @babel/preset-env rollup-plugin-babel --save-dev
- Create the
-
Create
script_name.rollup.js
in the config folderimport babel from 'rollup-plugin-babel'; export default { input: 'main.js', output: { file: 'bundle.js', format: 'iife', name: 'bundle' }, plugins: [ babel({ exclude: 'node_modules/**' }) ] }
-
Add the new script to the
package.json
"scripts": { "script_name": "rollup -c ./path_to_script/script_name" }
-
To avoid any errors with babel, use
npm install --save-dev @babel/preset-env
-
To build the
bundle.js
file, usenpm run script_name
-
Your
index.html
file should runbundle.js
like so<script src='./bundle.js' type='module'></script>
If ps1 cannot be loaded because running scripts is disabled on your system, then run the following command
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
- Remove the ESRI dependencies?