Webpack v4 does not support outputting external dependencies as ESM imports. The alt:V client-side engine will only
allow you to import the alt
runtime using an ESM import. Webpack v5 will have this ability, but this plugin can be used until then.
This plugin will take all of your alt:V dependencies (alt
, alt-client
, alt-server
), marks them as external dependencies,
and adds a single ESM import at the top of each output file that will be used in place of all of these modules.
The plugin is available via npm:
npm i -D altv-webpack-plugin
const AltvWebpackPlugin = require('altv-webpack-plugin');
module.exports = {
entry: './src/client/index.js',
plugins: [
new AltvWebpackPlugin() // no configuration needed
]
...
};