Skip to content

Commit 0d601be

Browse files
authored
Merge pull request #108 from the-alichemist/nova-4
2 parents 7b01eea + 3567182 commit 0d601be

File tree

10 files changed

+6553
-8880
lines changed

10 files changed

+6553
-8880
lines changed

composer.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@
88
"license": "MIT",
99
"require": {
1010
"lab404/laravel-impersonate": "^1.7.3",
11-
"laravel/nova": "^1.0|^2.0|^3.0"
11+
"laravel/nova": "^4.0"
1212
},
1313
"autoload": {
1414
"psr-4": {
1515
"KABBOUCHI\\NovaImpersonate\\": "src/"
1616
}
1717
},
18+
"repositories": [
19+
{
20+
"type": "composer",
21+
"url": "https://nova.laravel.com"
22+
}
23+
],
1824
"extra": {
1925
"laravel": {
2026
"providers": [

dist/js/field.js

Lines changed: 754 additions & 1 deletion
Large diffs are not rendered by default.

dist/js/tool.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/******/ (() => { // webpackBootstrap
2+
/******/ "use strict";
3+
/******/
4+
/******/
5+
/******/ })()
6+
;

dist/mix-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"/js/field.js": "/js/field.js"
3+
}

nova.mix.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
const mix = require('laravel-mix')
2+
const webpack = require('webpack')
3+
const path = require('path')
4+
5+
class NovaExtension {
6+
name() {
7+
return 'nova-extension'
8+
}
9+
10+
register(name) {
11+
this.name = name
12+
}
13+
14+
webpackConfig(webpackConfig) {
15+
webpackConfig.externals = {
16+
vue: 'Vue',
17+
}
18+
19+
webpackConfig.resolve.alias = {
20+
...(webpackConfig.resolve.alias || {}),
21+
'laravel-nova': path.join(
22+
__dirname,
23+
'../../vendor/laravel/nova/resources/js/mixins/packages.js'
24+
),
25+
}
26+
27+
webpackConfig.output = {
28+
uniqueName: this.name,
29+
}
30+
}
31+
}
32+
33+
mix.extend('nova', new NovaExtension())

package.json

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,28 @@
22
"private": true,
33
"scripts": {
44
"dev": "npm run development",
5-
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
6-
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
7-
"watch-poll": "npm run watch -- --watch-poll",
8-
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
5+
"development": "mix",
6+
"watch": "mix watch",
7+
"watch-poll": "mix watch -- --watch-options-poll=1000",
8+
"hot": "mix watch --hot",
99
"prod": "npm run production",
10-
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
10+
"production": "mix --production"
1111
},
1212
"devDependencies": {
13-
"cross-env": "^5.0.0",
14-
"laravel-mix": "^1.0"
13+
"@vue/compiler-sfc": "^3.2.22",
14+
"cross-env": "^5.2.1",
15+
"laravel-mix": "^6.0.41",
16+
"postcss": "^8.3.11",
17+
"resolve-url-loader": "^2.3.2",
18+
"sass": "^1.51.0",
19+
"sass-loader": "^12.6.0",
20+
"vue-loader": "^16.8.3"
1521
},
1622
"dependencies": {
17-
"vue": "^2.5.0"
23+
"@inertiajs/inertia": "^0.11.0",
24+
"@vue/compat": "^3.2.33",
25+
"form-backend-validation": "^2.4.0",
26+
"vue": "^3.0",
27+
"vuex": "^4.0.2"
1828
}
1929
}

resources/js/field.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Nova.booting((Vue, router) => {
2-
Vue.config.devtools = true;
2+
//Vue.config.devtools = true;
33
Vue.component(
4-
"index-impersonate-field",
5-
require("./components/Index/ImpersonateField")
4+
"IndexImpersonateField",
5+
require("./components/Index/ImpersonateField").default
66
);
77
Vue.component(
8-
"detail-impersonate-field",
9-
require("./components/Detail/ImpersonateField")
8+
"DetailImpersonateField",
9+
require("./components/Detail/ImpersonateField").default
1010
);
1111
});

vue.config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module.exports = {
2+
chainWebpack: config => {
3+
config.resolve.alias.set('vue', '@vue/compat')
4+
5+
config.module
6+
.rule('vue')
7+
.use('vue-loader')
8+
.tap(options => {
9+
return {
10+
...options,
11+
compilerOptions: {
12+
compatConfig: {
13+
MODE: 2
14+
}
15+
}
16+
}
17+
})
18+
}
19+
}

webpack.mix.js

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
1-
let mix = require('laravel-mix');
1+
let mix = require("laravel-mix");
2+
let path = require("path");
3+
require("./nova.mix");
24

3-
mix
4-
.js('resources/js/field.js', 'dist/js')
5-
.sass('resources/sass/field.scss', 'dist/css')
5+
mix.setPublicPath("dist")
6+
.js("resources/js/field.js", "js")
7+
.vue({
8+
version: 3,
9+
options: {
10+
compilerOptions: {
11+
isCustomElement: (tag) => ["portal"].includes(tag),
12+
},
13+
},
14+
})
15+
.nova("kabbouchi/nova-impersonate")
616
.webpackConfig({
717
resolve: {
8-
symlinks: false
9-
}
18+
symlinks: false,
19+
},
1020
});
21+
22+
mix.alias({
23+
"laravel-nova": path.join(
24+
__dirname,
25+
"vendor/laravel/nova/resources/js/mixins/packages.js"
26+
),
27+
});

0 commit comments

Comments
 (0)