From ea923053eb7245c56fa2fa6897d2f514f394cc03 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 2 Feb 2019 18:49:51 -0800 Subject: [PATCH] Miscelaneous fixes for WP --- package.json | 2 +- resources/assets/scripts/app.ts | 4 ---- resources/assets/scripts/pterodactyl-shims.d.ts | 3 +++ tsconfig.json | 8 +++++++- webpack.config.js | 3 ++- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 2aaeb8c3b..808b80400 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "watch": "NODE_ENV=development ./node_modules/.bin/webpack --watch --progress", "build": "NODE_ENV=development ./node_modules/.bin/webpack --progress", "build:production": "NODE_ENV=production ./node_modules/.bin/webpack", - "serve": "NODE_ENV=development webpack-dev-server --host 0.0.0.0 --hot --hot-only", + "serve": "NODE_ENV=development webpack-dev-server --host 0.0.0.0 --hot", "v:serve": "PUBLIC_PATH=http://pterodactyl.test:8080 yarn run serve", "compile:assets": "php artisan vue-i18n:generate & php artisan ziggy:generate resources/assets/scripts/helpers/ziggy.js" } diff --git a/resources/assets/scripts/app.ts b/resources/assets/scripts/app.ts index c7443bbd5..147e312d5 100644 --- a/resources/assets/scripts/app.ts +++ b/resources/assets/scripts/app.ts @@ -16,9 +16,7 @@ import router from './router'; Vue.config.productionTip = false; require('./bootstrap'); -// @ts-ignore window.events = new Vue(); -// @ts-ignore window.Ziggy = Ziggy; Vue.use(Vuex); @@ -26,7 +24,6 @@ Vue.use(VueRouter); Vue.use(VeeValidate); Vue.use(VueI18n); -// $FlowFixMe: this is always going to be unhappy because we ignore the vendor dir. const route = require('./../../../vendor/tightenco/ziggy/src/js/route').default; Vue.mixin({methods: {route}}); @@ -37,7 +34,6 @@ const i18n = new VueI18n({ messages: {...Locales}, }); -// $FlowFixMe if (module.hot) { module.hot.accept(); } diff --git a/resources/assets/scripts/pterodactyl-shims.d.ts b/resources/assets/scripts/pterodactyl-shims.d.ts index d4b002bc5..e8ab21b30 100644 --- a/resources/assets/scripts/pterodactyl-shims.d.ts +++ b/resources/assets/scripts/pterodactyl-shims.d.ts @@ -4,6 +4,8 @@ import {FlashInterface} from "./mixins/flash"; import {AxiosInstance} from "axios"; import {Vue as VueType} from "vue/types/vue"; import {ApplicationState} from "./store/types"; +// @ts-ignore +import {Ziggy} from './helpers/ziggy'; declare global { interface Window { @@ -13,6 +15,7 @@ declare global { jQuery: any, axios: AxiosInstance, events: VueType, + Ziggy: Ziggy, } } diff --git a/tsconfig.json b/tsconfig.json index 33336371e..b15575b75 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,13 @@ "lib": [ "es2016", "dom" - ] + ], + "baseUrl": ".", + "paths": { + "@/*": [ + "./resources/assets/scripts/*" + ] + } }, "include": [ "./resources/assets/scripts/**/*" diff --git a/webpack.config.js b/webpack.config.js index 5cecd2dd8..1058deaec 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -106,6 +106,7 @@ const cssLoaders = [ ]; module.exports = { + target: 'web', mode: process.env.NODE_ENV, devtool: isProduction ? false : 'inline-source-map', performance: { @@ -201,7 +202,7 @@ module.exports = { }, devServer: { contentBase: path.join(__dirname, 'public'), - publicPath: '/assets/', + publicPath: _.get(process.env, 'PUBLIC_PATH', '') + '/assets/', allowedHosts: [ '.pterodactyl.test', ],