PavelVanecek / gulp-crx

Pack Chrome Extension in the pipeline.
31 stars 3 forks source link

Again about "Cannot find module ...manifest.json" #14

Closed jonua closed 7 years ago

jonua commented 7 years ago

Hi,

I get an error message as in issues #11, #4.

{ Error: Cannot find module '/path/manifest.json'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at /path/node_modules/crx/src/crx.js:96:27
    at tryCatch (/path/node_modules/es6-promise/dist/lib/es6-promise/-internal.js:195:12)
    at invokeCallback (/path/node_modules/es6-promise/dist/lib/es6-promise/-internal.js:210:13)
    at /path/node_modules/es6-promise/dist/lib/es6-promise/then.js:24:16
    at flush (/path/node_modules/es6-promise/dist/lib/es6-promise/asap.js:94:5)
    at _combinedTickCallback (internal/process/next_tick.js:73:7) code: 'MODULE_NOT_FOUND' }

gulp task:

...
import plugins from "gulp-load-plugins"
...
gulp.task("create:crx", () => {
    gulp.src(`${dirs.target}/.`)
    .pipe(plugins().crxPack({
        privateKey: fs.readFileSync('./certs/chrome-key.pem', 'utf8'),
        filename: `${manifest.name}.crx`
    }))
    .pipe(gulp.dest(`${dirs.target}`))
});

task executes in a sequence:

gulp.task("build", () => {
    runSequence(
        "clean",
        [
            "transform:pages",
            "transform:styles",
            "transform:js",
            "copy:resources",
            "copy:manifest"
        ],
        "create:crx"
    )
});

This bug can now be seen in my project if run the command

gulp build
PavelVanecek commented 7 years ago

I just tried to run your project and the create:crx step works fine:

image