omnichronous / multimix Goto Github PK
View Code? Open in Web Editor NEWmultiple builds with Laravel Mix
multiple builds with Laravel Mix
I keep getting this error saying that The Mix manifest does not exist.
It does get correctly created for the frontend and backend, but when using {{ mix('backend/css/app.css') }}
it looks in public/manifest-json.js
instead of looking for it in backend/manifest-json.js
.
Any workaround on this?
edit:
let me answer my own question:
In Illuminate/Foundation/helpers.php line 550
you can see it the mix() helper function has allows for a second argument, the directory of the manifest file.
For a file located in public/app/css/app.css
you would use:
<link rel="stylesheet" href="{{ mix('css/app.css', 'app') }}">
Following your package.json scripts, when i run npm run watch it gives me the following error:
0 info it worked if it ends with ok
1 verbose cli [ '/home/jose/.nvm/versions/node/v10.14.1/bin/node',
1 verbose cli '/home/jose/.nvm/versions/node/v10.14.1/bin/npm',
1 verbose cli 'run',
1 verbose cli 'watch' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prewatch', 'watch', 'postwatch' ]
5 info lifecycle @~prewatch: @
6 info lifecycle @~watch: @
7 verbose lifecycle @~watch: unsafe-perm in lifecycle true
8 verbose lifecycle @~watch: PATH: /home/jose/.nvm/versions/node/v10.14.1/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/var/www/marketplace/node_modules/.bin:/home/jose/.nvm/versions/node/v10.14.1/bin:/home/jose/bin:/home/jose/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/jose/.composer/vendor/bin
9 verbose lifecycle @~watch: CWD: /var/www/marketplace
10 silly lifecycle @~watch: Args: [ '-c', 'npm run development -- --watch' ]
11 silly lifecycle @~watch: Returned: code: 1 signal: null
12 info lifecycle @~watch: Failed to exec watch script
13 verbose stack Error: @ watch: npm run development -- --watch
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (/home/jose/.nvm/versions/node/v10.14.1/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess. (/home/jose/.nvm/versions/node/v10.14.1/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:962:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid @
15 verbose cwd /var/www/marketplace
16 verbose Linux 4.15.0-76-generic
17 verbose argv "/home/jose/.nvm/versions/node/v10.14.1/bin/node" "/home/jose/.nvm/versions/node/v10.14.1/bin/npm" "run" "watch"
18 verbose node v10.14.1
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error @ watch: npm run development -- --watch
22 error Exit status 1
23 error Failed at the @ watch script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Hello.
Tell me please, why my configuration is not working?
webpack.mix.js
let fs = require('fs'),
mix = require('laravel-mix'),
srcPath = 'resources/',
publicPath = 'public_html/assets/',
pathImg = 'images',
pathFont = 'fonts';
mix.setPublicPath(publicPath).setResourceRoot('/assets/');
mix.copy(srcPath + pathFont, publicPath + pathFont).copy(srcPath + pathImg, publicPath + pathImg);
fs.readdir(__dirname, (err, files) => {
files.forEach(file => {
if (/\.mix\..*\.js/.test(file)) {
require(__dirname + '/' + file);
}
});
});
webpack.mix.offsite.js
let mix = require('laravel-mix'),
srcPath = 'resources/',
publicPath = 'public_html/assets/';
mix.js(srcPath + 'js/offsite.js', publicPath + '/js/offsite/app.js')
.sass(srcPath + 'scss/offsite/app.scss', publicPath + 'css/offsite')
.extract()
.version();
My dev
command is node node_modules/cross-env/src/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
Result of yarn dev
is https://skr.sh/s5OUXkjNXkg (no one of other mix files are not processed).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.