Fix RAGE client-side export definition

This commit is contained in:
Micah Allen 2019-02-02 20:46:00 -05:00
parent ce551c2afe
commit f724e9dc91
4 changed files with 26 additions and 5 deletions

File diff suppressed because one or more lines are too long

6
package-lock.json generated
View File

@ -4161,6 +4161,12 @@
"integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=",
"dev": true "dev": true
}, },
"replace-in-file-webpack-plugin": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/replace-in-file-webpack-plugin/-/replace-in-file-webpack-plugin-1.0.6.tgz",
"integrity": "sha512-+KRgNYL2nbc6nza6SeF+wTBNkovuHFTfJF8QIEqZg5MbwkYpU9no0kH2YU354wvY/BK8mAC2UKoJ7q+sJTvciw==",
"dev": true
},
"require-directory": { "require-directory": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",

View File

@ -1,6 +1,6 @@
{ {
"name": "rage-rpc", "name": "rage-rpc",
"version": "0.1.0", "version": "0.1.1",
"description": "An asynchronous RPC implementation for RAGE Multiplayer", "description": "An asynchronous RPC implementation for RAGE Multiplayer",
"main": "dist/rage-rpc.min.js", "main": "dist/rage-rpc.min.js",
"types": "dist/rage-rpc.d.ts", "types": "dist/rage-rpc.d.ts",
@ -27,6 +27,7 @@
"@babel/preset-env": "^7.2.3", "@babel/preset-env": "^7.2.3",
"@babel/preset-typescript": "^7.1.0", "@babel/preset-typescript": "^7.1.0",
"babel-loader": "^8.0.5", "babel-loader": "^8.0.5",
"replace-in-file-webpack-plugin": "^1.0.6",
"typescript": "^3.2.2", "typescript": "^3.2.2",
"webpack": "^4.23.1", "webpack": "^4.23.1",
"webpack-cli": "^3.1.2" "webpack-cli": "^3.1.2"

View File

@ -1,4 +1,8 @@
const path = require('path'); const path = require('path');
const ReplaceInFileWebpackPlugin = require('replace-in-file-webpack-plugin');
const LIBRARY_NAME = 'rpc';
const OUTPUT_FILE = 'rage-rpc.min.js';
module.exports = { module.exports = {
entry: './src/index.ts', entry: './src/index.ts',
@ -16,9 +20,19 @@ module.exports = {
}, },
output: { output: {
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, 'dist'),
filename: 'rage-rpc.min.js', filename: OUTPUT_FILE,
library: 'rpc', library: LIBRARY_NAME,
libraryTarget: 'umd', libraryTarget: 'umd',
globalObject: "typeof self !== 'undefined' ? self : this" globalObject: "typeof self !== 'undefined' ? self : this"
} },
plugins: [
new ReplaceInFileWebpackPlugin([{
dir: 'dist',
files: [OUTPUT_FILE],
rules: [{
search: `exports.${LIBRARY_NAME}`,
replace: 'exports'
}]
}])
]
}; };