Skip to content

Commit

Permalink
Merge pull request #4 from laravel-frontend-presets/chore/update-for-…
Browse files Browse the repository at this point in the history
…inertia-0.1

Update the frontend preset for InertiaJS 0.1
  • Loading branch information
michaeldyrynda authored Aug 14, 2019
2 parents fc0fbc4 + 8c0b6c8 commit 4a88334
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"require": {
"laravel/framework": "^5.8",
"inertiajs/inertia-laravel": "dev-master"
"inertiajs/inertia-laravel": "^0.1"
},
"require-dev": {
"orchestra/testbench": "^3.8"
Expand Down
6 changes: 2 additions & 4 deletions src/InertiaJsPreset.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,14 @@ protected static function updatePackageArray(array $packages)
{
return array_merge([
'@babel/plugin-syntax-dynamic-import' => '^7.2.0',
'inertia' => 'github:inertiajs/inertia',
'inertia-vue' => 'inertiajs/inertia-vue',
'@inertiajs/inertia' => '^0.1.0',
'@inertiajs/inertia-vue' => '^0.1.0',
'vue-template-compiler' => '^2.6.10',
], $packages);
}

protected static function updateBootstrapping()
{
copy(__DIR__.'/inertiajs-stubs/.babelrc', base_path('.babelrc'));

copy(__DIR__.'/inertiajs-stubs/webpack.mix.js', base_path('webpack.mix.js'));

copy(__DIR__.'/inertiajs-stubs/resources/js/app.js', resource_path('js/app.js'));
Expand Down
3 changes: 0 additions & 3 deletions src/inertiajs-stubs/.babelrc

This file was deleted.

6 changes: 3 additions & 3 deletions src/inertiajs-stubs/resources/js/app.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
require('./bootstrap')

import Inertia from 'inertia-vue'
import { InertiaApp } from '@inertiajs/inertia-vue'
import Vue from 'vue'

Vue.use(Inertia)
Vue.use(InertiaApp)

let app = document.getElementById('app')

new Vue({
render: h => h(Inertia, {
render: h => h(InertiaApp, {
props: {
initialPage: JSON.parse(app.dataset.page),
resolveComponent: (name) => {
Expand Down
12 changes: 8 additions & 4 deletions src/inertiajs-stubs/webpack.mix.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
const mix = require('laravel-mix')
const path = require('path')

mix.sass('resources/sass/app.scss', 'public/css')
.js('resources/js/app.js', 'public/js').webpackConfig({
output: { chunkFilename: 'js/[name].[contenthash].js' },
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css')
.webpackConfig({
output: { chunkFilename: 'js/[name].js?id=[chunkhash]' },
resolve: {
alias: {
'vue$': 'vue/dist/vue.runtime.js',
'vue$': 'vue/dist/vue.runtime.esm.js',
'@': path.resolve('resources/js'),
},
},
})
.babelConfig({
plugins: ['@babel/plugin-syntax-dynamic-import']
})

0 comments on commit 4a88334

Please sign in to comment.