This repository has been archived by the owner. It is now read-only.

Error when packaging code with sp-pnp-js #400

Closed
ravenboilinux opened this Issue Apr 5, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@ravenboilinux

ravenboilinux commented Apr 5, 2017

Category

[ ] Enhancement

[X ] Bug

[ ] Question

Version

Please specify what version of the library you are using: [ ^2.0.2 ]

Expected / Desired Behavior / Question

that webpack/babel works correctly. This works in ^1.0.6 but not in ^2.0.2

Observed Behavior

when i run the commend gulp package:debug-code
webpack throws this error:
ERROR in ./~/sp-pnp-js/lib/pnp.js
Module build failed: Error: Couldn't find preset "latest" relative to directory "C:\code\SupplierForms\node_modules\sp-pnp-js"
at C:\code\SupplierForms\node_modules\babel-core\lib\transformation\file\options\option-manager.js:292:19
at Array.map (native)
at OptionManager.resolvePresets (C:\code\SupplierForms\node_modules\babel-core\lib\transformation\file\options\option-manager.js:274:20)
at OptionManager.mergePresets (C:\code\SupplierForms\node_modules\babel-core\lib\transformation\file\options\option-manager.js:263:10)
at OptionManager.mergeOptions (C:\code\SupplierForms\node_modules\babel-core\lib\transformation\file\options\option-manager.js:248:14)
at OptionManager.init (C:\code\SupplierForms\node_modules\babel-core\lib\transformation\file\options\option-manager.js:367:12)
at File.initOptions (C:\code\SupplierForms\node_modules\babel-core\lib\transformation\file\index.js:216:65)
at new File (C:\code\SupplierForms\node_modules\babel-core\lib\transformation\file\index.js:139:24)
at Pipeline.transform (C:\code\SupplierForms\node_modules\babel-core\lib\transformation\pipeline.js:46:16)
at transpile (C:\code\SupplierForms\node_modules\babel-loader\lib\index.js:38:20)
at Object.module.exports (C:\code\SupplierForms\node_modules\babel-loader\lib\index.js:133:12)
@ ./debugging/src/app-config.js 4:18-38

ERROR in ./~/sp-pnp-js/lib/utils/logging.js
Module build failed: Error: Couldn't find preset "latest" relative to directory "C:\\code\\SupplierForms\\node_modules\\sp-pnp-js"
    at C:\code\SupplierForms\node_modules\babel-core\lib\transformation\file\options\option-manager.js:292:19
    at Array.map (native)
    at OptionManager.resolvePresets (C:\code\SupplierForms\node_modules\babel-core\lib\transformation\file\options\option-manager.js:274:20)
    at OptionManager.mergePresets (C:\code\SupplierForms\node_modules\babel-core\lib\transformation\file\options\option-manager.js:263:10)
    at OptionManager.mergeOptions (C:\code\SupplierForms\node_modules\babel-core\lib\transformation\file\options\option-manager.js:248:14)
    at OptionManager.init (C:\code\SupplierForms\node_modules\babel-core\lib\transformation\file\options\option-manager.js:367:12)
    at File.initOptions (C:\code\SupplierForms\node_modules\babel-core\lib\transformation\file\index.js:216:65)
    at new File (C:\code\SupplierForms\node_modules\babel-core\lib\transformation\file\index.js:139:24)
    at Pipeline.transform (C:\code\SupplierForms\node_modules\babel-core\lib\transformation\pipeline.js:46:16)
    at transpile (C:\code\SupplierForms\node_modules\babel-loader\lib\index.js:38:20)
    at Object.module.exports (C:\code\SupplierForms\node_modules\babel-loader\lib\index.js:133:12)
 @ ./debugging/src/SharePointContext.js 5:16-54

Steps to Reproduce

using the webpack config below and
webpack.config.debug.txt
and if you use the gulp task

'''javascript

gulp.task("package:debug-code", ["build:debug"], (done) => {

webpack(webpackConfigDebug, (err, stats) => {

    if (err) {
        throw new gutil.PluginError("package:code", err);
    }
        
    console.log(stats.toString({
        colors: true
    }));

    done();
});

});
'''

Submission Guidelines

Thanks!

@ravenboilinux

This comment has been minimized.

ravenboilinux commented Apr 5, 2017

if i change the .babelrc file under sp-pnp-js it package without an error

@patrick-rodgers

This comment has been minimized.

Contributor

patrick-rodgers commented Apr 6, 2017

Can you share the change that fixes it? I haven't had a chance to look into this but if possible would like to slip a fix in for Friday's 2.0.3 release. Or you can submit a PR of course as well :)

Thanks!

@ravenboilinux

This comment has been minimized.

ravenboilinux commented Apr 6, 2017

all i did is change the name of the .babelrc file to .babelrc.old and i was able to webpack it again

I am still very new to babel/webpack/gulp

I think it has to do that the newest version of babel has lastest preset deprecated

https://babeljs.io/docs/plugins/preset-latest/

@patrick-rodgers

This comment has been minimized.

Contributor

patrick-rodgers commented Apr 6, 2017

Ok, I have deleted the file in this PR. That is good cleanup anyway as we are no longer using babel so don't need the file. Thanks! Will be in 2.0.3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.