FYI, if fails building via webpack (both when piping or not piping it through babel).
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.3 LTS
Release: 14.04
Codename: trusty
$ node -v
v6.9.1
$ npm -v webpack
3.10.8
'use strict';
import p2 from 'p2'; // eslint-disable-line no-unused-vars
class TestPhysicsP2 {
constructor () {
console.log('Hello to TestPhysicsP2');
}
}
export default TestPhysicsP2;
Building via webpack throws error
ERROR in ./~/p2/package.json
Module parse failed: /path/to/the/project/node_modules/p2/package.json Unexpected token (2:9)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (2:9)
at Parser.pp$4.raise (/path/to/the/project/node_modules/webpack/node_modules/acorn/dist/acorn.js:2221:15)
at Parser.pp.unexpected (/path/to/the/project/node_modules/webpack/node_modules/acorn/dist/acorn.js:603:10)
at Parser.pp.semicolon (/path/to/the/project/node_modules/webpack/node_modules/acorn/dist/acorn.js:581:61)
at Parser.pp$1.parseExpressionStatement (/path/to/the/project/node_modules/webpack/node_modules/acorn/dist/acorn.js:966:10)
at Parser.pp$1.parseStatement (/path/to/the/project/node_modules/webpack/node_modules/acorn/dist/acorn.js:730:24)
at Parser.pp$1.parseBlock (/path/to/the/project/node_modules/webpack/node_modules/acorn/dist/acorn.js:981:25)
at Parser.pp$1.parseStatement (/path/to/the/project/node_modules/webpack/node_modules/acorn/dist/acorn.js:709:33)
at Parser.pp$1.parseTopLevel (/path/to/the/project/node_modules/webpack/node_modules/acorn/dist/acorn.js:638:25)
at Parser.parse (/path/to/the/project/node_modules/webpack/node_modules/acorn/dist/acorn.js:516:17)
at Object.parse (/path/to/the/project/node_modules/webpack/node_modules/acorn/dist/acorn.js:3098:39)
@ ./~/p2/src/p2.js 48:13-39
Currently as a super quick fix I just include the prebuilt
import p2 from 'p2/build/p2.js';
I don't have time to investigate further the reasons, but first thing that vas visible is that you are using node 4.2.2 (it is LTS), there were quite a lot changes to the newest LTS (v6) see plan, and I remember already fighting some acorn errors due to that some time ago.
FYI, if fails building via webpack (both when piping or not piping it through babel).
Building via webpack throws error
Currently as a super quick fix I just include the prebuilt
I don't have time to investigate further the reasons, but first thing that vas visible is that you are using node 4.2.2 (it is LTS), there were quite a lot changes to the newest LTS (v6) see plan, and I remember already fighting some acorn errors due to that some time ago.
Not breaking, but as said - FYI :)