Atnaize
Atnaize

Reputation: 1816

Custom webpack configuration

I'm using Laravel 5.6 and I would like to add the vtk.js dependency.

I'm using the basic configuration of webpack included by laravel-mix. I'm creating my default app.js and don't want to change this behaviour. So vtk should be included in the app.js.

I also saw that we can add a custom webpack config like this

mix.webpackConfig({
    resolve: {
        modules: [
            path.resolve(__dirname, 'node_modules'),
        ]
    }
});

But I realy don't know how to include the module.exports and module from the webpack of js in the mix of laravel...

Upvotes: 1

Views: 484

Answers (2)

PlayMa256
PlayMa256

Reputation: 6841

const path = require('path');
const webpack = require('webpack');
const vtkRules = require('vtk.js/Utilities/config/dependency.js').webpack.v2.rules;

mix.webpackConfig({
    module: {
        rules: [...vtkRules]
    },
    resolve: {
        modules: [
            path.resolve(__dirname, 'node_modules'),
        ]
    }
});

I'm not used to VTK, you have to import/configure everything else on your app.js, which is your entrypoint.

Upvotes: 1

Raj Kamal Maurya
Raj Kamal Maurya

Reputation: 11

You have to append the path your js file in your webpack run npm dev

Upvotes: 1

Related Questions