-
-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when starting @ngtools/webpack plugin via "grunt-webpack" #168
Comments
finally we found the actual error. |
@anbaran have you not found the actual bug either? |
the problem is that we cant even see it touch grunt-webpack, thats the problem. |
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? |
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. |
for now, i created a 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)
});
}) |
Ok great, I will test it this week |
Hello,
|
first, make sure it works with CLI, eg:
then it will work with the grunt task as well, for sure. basically, it is the same execution. |
been using it the way you told me and i created a grunt task that actually uses the webpack cli from a config file... |
@anbaran have you created the config file? |
@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 |
When I start the webpack plugin @ngtools/webpack via grunt-webpack it results in error. When I start this same plugin directly via webpack it works without errors. I created minimal sample app to demonstrate this behavior.
How to reproduce
git clone https://github.com/anbaran/ngtools-webpack-error.git
cd ngtools-webpack-error
npm install -g grunt-cli
npm install
Now we have 2 options, run the webpack task directly in webpack or via grunt-webpack integration
Case 1 - Using webpack directly - compilation completes without error
Result: no error, compilation successful
Case 2 - Using grunt integration for webpack , the "grunt-webpack" - compilation results in error (see below)
Result:
Expected Behavior
Running a task via grunt-webpack or directly webpack should produce the same result
Context
One of the subtasks of my grunt build process is to compile Angular application using webpack plugin "@ngtools/webpack"
Your Environment
grunt: 1.0.3,
grunt-webpack: 3.1.3,
webpack: 3.12.0
node v10.10.0
npm 6.4.1
Linux Ubuntu VERSION="16.04.4 LTS (Xenial Xerus)
The text was updated successfully, but these errors were encountered: