Giter Site home page Giter Site logo

Comments (12)

p3x-robot avatar p3x-robot commented on June 20, 2024

finally we found the actual error.

from grunt-webpack.

p3x-robot avatar p3x-robot commented on June 20, 2024

@anbaran have you not found the actual bug either?

from grunt-webpack.

p3x-robot avatar p3x-robot commented on June 20, 2024

the problem is that we cant even see it touch grunt-webpack, thats the problem.

from grunt-webpack.

anbaran avatar anbaran commented on June 20, 2024

No, i didnt investigate it deeper. Look at the demo app. The compilation works when run directly in webpack and it fails if grunt-webpack is used. So I assume it is grunt-webpack problem. I didn't have time (and knowledge) so far to analyse why exactly grunt-webpack fails. Do you have any new details?

from grunt-webpack.

p3x-robot avatar p3x-robot commented on June 20, 2024

yeah i started looking at, because it is totally because of this and the program is not so big so i could catch the error.

from grunt-webpack.

p3x-robot avatar p3x-robot commented on June 20, 2024

for now, i created a grunt task that actually works:

grunt.registerTask('grunt-webpack-build', function() {
    const done = this.async();
    const exec = require('child_process').exec;
    let configFile
    // you can change the webpack config file with some if....
    configFile = `${__dirname}/webpack.config.js`
    const run = exec(`./node_modules/.bin/webpack-cli --production --config ${configFile}`, {
        stdio: 'inherit',
        shell: true,
        customFds: [0,1,2],
    }, (e, stdout, stderr) => {
        if (e) {
            done(e);
            return
        }
        done();
    });
    run.stdout.on('data', (data) => {
        grunt.log.write(data)
    });

    run.stderr.on('data', (data) => {
        grunt.log.write(data)
    });
})

from grunt-webpack.

anbaran avatar anbaran commented on June 20, 2024

Ok great, I will test it this week

from grunt-webpack.

anbaran avatar anbaran commented on June 20, 2024

Hello,
I just tried your solution but I receive the following error, do you know what is going on there?

Warning: Command failed: ./node_modules/.bin/webpack-cli --production --config <project-location>ngtools-webpack-error/webpack.config.js
<project-location>/ngtools-webpack-error/node_modules/webpack-cli/bin/cli.js:291
			const statsPresetToOptions = require("webpack").Stats.presetToOptions;
			                                                     ^

TypeError: Cannot read property 'presetToOptions' of undefined
    at processOptions (<project-location>/ngtools-webpack-error/node_modules/webpack-cli/bin/cli.js:291:57)
    at yargs.parse (<project-location>/ngtools-webpack-error/node_modules/webpack-cli/bin/cli.js:536:3)
    at Object.parse (<project-location>/ngtools-webpack-error/node_modules/webpack-cli/node_modules/yargs/yargs.js:563:18)
    at <project-location>/ngtools-webpack-error/node_modules/webpack-cli/bin/cli.js:219:8
    at Object.<anonymous> (<project-location>/ngtools-webpack-error/node_modules/webpack-cli/bin/cli.js:538:3)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:279:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:696:3)
 Use --force to continue. 

from grunt-webpack.

p3x-robot avatar p3x-robot commented on June 20, 2024

first, make sure it works with CLI, eg:

webpack --production --config <config-path-file>

then it will work with the grunt task as well, for sure. basically, it is the same execution.

from grunt-webpack.

p3x-robot avatar p3x-robot commented on June 20, 2024

been using it the way you told me and i created a grunt task that actually uses the webpack cli from a config file...

from grunt-webpack.

p3x-robot avatar p3x-robot commented on June 20, 2024

@anbaran have you created the config file? configFile = __dirname + '/webpack.config.js'?

from grunt-webpack.

anbaran avatar anbaran commented on June 20, 2024

@p3x-robot p3x-robot Sorry I didn't answer you yet but I am busy in a different area, I will let you know soon

from grunt-webpack.

Related Issues (20)

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.