GithubHelp home page GithubHelp logo

m2sd / nuxt-laravel Goto Github PK

View Code? Open in Web Editor NEW
100.0 5.0 11.0 3.71 MB

Nuxt module for integration with the Laravel framework

License: MIT License

JavaScript 35.42% TypeScript 62.59% HTML 1.93% Shell 0.06%
nuxt laravel spa vue nuxt-module laravel-nuxt pwa

nuxt-laravel's People

Contributors

dependabot[bot] avatar mental-maze avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nuxt-laravel's Issues

Strange behavior with PHP 7.4

Hi!

I switched from PHP 7.2 to PHP 7.4 due to some requirements in the laravel context and discovered a strange behavior with the running development servers. After calling yarn run dev the console starts logging the following entries every 2-3 seconds:

[Sat Mar 14 22:05:55 2020] 127.0.0.1:51100 Accepted
[Sat Mar 14 22:05:55 2020] 127.0.0.1:51100 Closing
[Sat Mar 14 22:05:58 2020] 127.0.0.1:51129 Accepted
[Sat Mar 14 22:05:58 2020] 127.0.0.1:51129 Closing
[Sat Mar 14 22:06:01 2020] 127.0.0.1:51144 Accepted
[Sat Mar 14 22:06:01 2020] 127.0.0.1:51144 Closing
[Sat Mar 14 22:06:04 2020] 127.0.0.1:51159 Accepted
[Sat Mar 14 22:06:04 2020] 127.0.0.1:51159 Closing
[Sat Mar 14 22:06:06 2020] 127.0.0.1:51174 Accepted
[Sat Mar 14 22:06:07 2020] 127.0.0.1:51174 Closing

As you can see, the port changes with every call. Unfortunately i have no idea which process triggers these calls. Do you have any idea or suggestion? If you need more information, just drop me a short line.

Thnx in advance.
Flo

Missing closing bracket in readme

Replace

return file_get_contents(env('NUXT_OUTPUT_PATH', public_path('spa.html'));

With

return file_get_contents(env('NUXT_OUTPUT_PATH', public_path('spa.html')));

'render-before' hook deletes entire public directory

In module.js on line 125, this code is run:
fs_extra_1.default.removeSync(config.output.dest);

But the problem is that by default config.output.dest is set to public/ which can be verified by logging the variable.

I believe that the output should be only removing the nuxt output directory, as laravel has it's index.php files that are required to be in the public directory.

I have tried to move the index.php file to the static/ directory, but it does not copy the files for the development server and the laravel server cannot launch as the `public/' directory no longer exists.

Rendering everything to one JS file

I'm adding Nuxt to an existing Laravel application that has its own HTML layout template and currently expects one JS file. Currently the application uses Laravel Mix to compile everything to one JS file and write the JS assets to the public folder. Laravel takes care of the rest.

How do I configure nuxt-laravel to do the same thing? It would suffice to deploy the compiled JS files in such a way that I can find them from Laravel and add them to my template. Thanks.

Route [nuxt] not defined.

I added nuxt-laravel package in my previous laravel and nuxt based application. By following the "Easy Method" procedure, I could successfully configure the complete application for both laravel and nuxt, build and generate spa into laravel's public directory. My config/nuxt.php is as follows:

<?php

return [
    'routing' => true,
    'prefix'  => 'app',
    'source'  => env('NUXT_OUTPUT_PATH', public_path('spa.html')),
    'ssr'     => env('NUXT_SSR_PROXY', false),
];

I added route('nuxt'); to my routes/web.php file, which however returns Route [nuxt] not defined. exception when visiting the url. Is there anything wrong with my configuration? Thanks!

Rendering meta tags in server side while there is no SSR by now

Hi, I'm stuck in rendering my meta tags in server side, crawlers and debuggers (mainly facebook an twitter) do not detect them what is truly sad because this is an amazing package and so glad to use it, but really I can't figure out how to find out a possible solution, so my question is basically what approach do you make to render meta tags and be readable for crawlers/debuggers while has no server rendering? Thanks, any idea will appreciated.

Axios uses wrong port

Axios seems to be using wrong default nuxt port 3000.
Can be easly fixed by adding following to nuxt.config.js:

config.axios = {
  baseURL: 'http://localhost:3001'
};

Added Support to Nuxt Content

This plugin is great for an integration more hand in hand with laravel, but with nuxt content something similar to what pwa has happens so I have to think that a similar integration has to be carried out, I hope you can help me integrate it thanks.

No spa.html

I have no idea what I'm doing wrong. The Nuxt server isn't producing the spa.html file. It's not throwing any error messages either:

$ npm run development

> [email protected] development /home/jay/Documents/industrial
> cross-env NODE_ENV=development nodemon server.js --watch server

[nodemon] 1.19.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching dir(s): server
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node server.js`
Laravel development server started: http://127.0.0.1:3001
[Thu Jun 18 17:11:34 2020] PHP 7.4.7 Development Server (http://127.0.0.1:3001) started
ℹ Preparing project for development
ℹ Initial build may take a while
✔ Builder initialized
✔ Nuxt files generated

✔ Client
  Compiled successfully in 17.70s

ℹ Waiting for file changes
Server listening on http://localhost:3000.

Here's my nuxt.config.js object, stripped down to remove all other dependencies:

{
	mode: 'spa',
	dev: _isDevelopment,
	vue: {
		config: {
			debug: _isDevelopment,
			productionTip: false,
			devtools: _isDevelopment,
		},
	},
	laravel: {
		dotEnvExport: false
	},
	head: {
		title: process.env.npm_package_name || '',
		meta: [{
			charset: 'utf-8',
		},
		{
			name: 'viewport',
			content: 'width=device-width, initial-scale=1',
		},
		{
			hid: 'description',
			name: 'description',
			content: process.env.npm_package_description || '',
		},
		],
		link: [{
			rel: 'icon',
			type: 'image/x-icon',
			href: '/favicon.ico',
		}],
	},
	loading: { color: '#fff', },
	css: [],
	plugins: [	],
	buildModules: [
		'@nuxtjs/eslint-module',
	],
	modules: [
		'nuxt-laravel',
	],
	components: [	],
	build: { extend(config, ctx) {}, },
}

SSR

Hi. Whats the point to use nuxt, if i cant use ssr. Maybe someday u realize universal mode?

WARN nuxt-laravel currently only supports 'spa' mode

Wrong named output file in publicDir

Hi.

Referring to the documentation I think there is an error in your code. The documentation said:

If nuxtConfig.router.base is not set the SPA will be generated in the publicDir root with an index file name of spa.html.

If nuxtConfig.router.base is set the SPA will be generated in a corresponding location inside publicDir with the default index file name index.html.

So i was wondering why i got a spa.html in my output folder. After a quick look in your module I think your if-condition has to be changed:

fallback: `${routerBase.length > 1 ? 'spa' : 'index'}.html`,

Kind regards,
Flo

Windows path problem

Hello.
When using the package on windows (without wsl), I encountered a problem that the links for proxy are not generated correctly.

For example: when used default settings and

// nuxt.config.js
router: {
    base: '/app/',
},

NUXT_OUTPUT_PATH equals "http://localhost:3000//app/__nuxt_laravel" which does not work
and proxy rules are incorrect

[
  '**/*',
  '!\\app\\__nuxt_laravel'
]

This all leads to php server errors, and the inability to open nuxt files.
As a quick fix, you can use the "slash" package.

// https://github.com/m2sd/nuxt-laravel/blob/master/src/module.ts#L136
        ['**/*', `!${slash(path.join(baseUrl, moduleKey))}`],
// https://github.com/m2sd/nuxt-laravel/blob/master/src/module.ts#L238
          slash(path.join(baseUrl, moduleKey)),

On windows, this solves the problem, and everything starts to work correctly.
Or is there some other solution to this problem?

Add Laravel to Nuxt

Hi,
So I have a Nuxt.js project and I want to add Laravel.
I added npm install --save-dev @nuxtjs/axios @nuxtjs/proxy nuxt-laravel
And I added 'nuxt-laravel' to modules as well, but I am not sure what the next steps are. When I do npm run dev I get a message that Laravel support is disabled.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.