Using webpack, I'm creating a Library extension. The issue is that the Library should be loaded from a [certain server.]
The main class of the extension stats with:
class MyExtension extends Autodesk.Viewing.Extension {
  // ...
}
The HTML code:
<script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/6.*/viewer3D.min.js"></script>
<script src="lib/extension.js"></script>
The issue is that the Autodesk constant isn't a npm module, so when both JS files are included this error is thrown:
Uncaught ReferenceError: Autodesk is not defined
My question is: How to build this extension in a way it will be evaluated after page load?
Obs: It works when using the webpack dev build but won't work with the production build.
Edit: It works the I load the JS files on the main page. This issue happens when the libs are loaded in an AJAX request (Specifically I'm using it in a Bootstrap tab)
package.json
{
  "name": "extension",
  "version": "1.0.0",
  "description": "",
  "main": "src/index.js",
  "scripts": {
    "build": "WEBPACK_ENV=build webpack",
    "dev": "WEBPACK_ENV=dev webpack --progress --watch --log-level=debug"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/cli": "^7.0.0",
    "@babel/core": "^7.0.0",
    "@babel/plugin-proposal-class-properties": "^7.0.0",
    "@babel/polyfill": "^7.0.0",
    "@babel/preset-env": "^7.0.0",
    "@babel/register": "^7.0.0",
    "babel": "^6.23.0",
    "babel-loader": "^8.0.0",
    "css-loader": "^1.0.0",
    "node-sass": "^4.9.3",
    "sass-loader": "^7.1.0",
    "style-loader": "^0.23.0",
    "webpack": "^4.17.1",
    "webpack-cli": "^3.1.0",
    "webpack-command": "^0.4.1",
    "webpack-dev-server": "^3.1.7"
  },
  "dependencies": {
    "lodash": "^4.17.10"
  }
}
 
     
    