SyntaxError: Unexpected token '.' when using webpack PerspectivePlugin #1687
Closed
Description
Bug Report
On the latest @finos/perspective-webpack-plugin and wepback, I am getting a SyntaxError: Unexpected token '.'
error any time I try to include the PerspectivePlugin
.
Steps to Reproduce:
I noticed this on a larger project, but the same error happens with a minimal config.
# Go to an empty folder
# Install perspective
yarn add @finos/perspective @finos/perspective-viewer @finos/perspective-viewer-d3fc @finos/perspective-viewer-datagrid @finos/perspective-webpack-plugin
# Install webpack
yarn add --dev webpack webpack-cli
# Create a very simple config file
printf "
const PerspectivePlugin = require('@finos/perspective-webpack-plugin');
module.exports = {
plugins: [
new PerspectivePlugin()
]
};
" >> webpack.config.js
# Try to run webpack
./node_modules/.bin/webpack webpack.config.js
Expected Result:
Webpack compiles
Actual Result:
Webpack errors with:
SyntaxError: Unexpected token '.'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/kpreston/Code/lib/perspective-webpack-error/node_modules/@finos/perspective-webpack-plugin/index.js:10:22)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
The erroring line from @finos/perspective-webpack-plugin/index.js
reads:
const {get_config} = require("@finos/perspective");
Environment:
Node: 12.22.3
Packages:
"@finos/perspective": "^1.0.8",
"@finos/perspective-viewer": "^1.0.8",
"@finos/perspective-viewer-d3fc": "^1.0.8",
"@finos/perspective-viewer-datagrid": "^1.0.8",
"@finos/perspective-webpack-plugin": "^1.0.8",
"webpack": "^5.65.0",
Metadata
Assignees
Labels
No labels