I have developed a compact JS module that I plan to transform into an npm package, although at the moment it is only available on GitHub. This module has been built using ES6 and SCSS, making use of webpack and babel for transpilation.
To conduct its testing, I set up a separate project with a similar configuration (utilizing webpack and babel). Following the npm installation of my module, when attempting to import it into my index.js file, Chrome Developer Tools throws the following error: (where x stands for the name of my module)
index.js:11 Uncaught TypeError: x__WEBPACK_IMPORTED_MODULE_1___default.a is not a constructor
at eval (index.js:11)
at Object../src/index.js (main.js:368)
at __webpack_require__ (main.js:20)
at eval (webpack:///multi_(:8081/webpack)-dev-server/client?:2:18)
at Object.0 (main.js:390)
at __webpack_require__ (main.js:20)
at main.js:69
at main.js:72
Despite going through numerous responses and attempting various solutions, the issue remains unresolved. The setup for my module is outlined below.
.babelrc
{
"presets": [
["env", {
"targets": {
"browsers": ["ie >= 11"]
}
}]
],
"plugins": [
"transform-es2015-modules-commonjs",
"transform-class-properties"
]
}
webpack.common.js
const path = require('path')
...
webpack.prod.js
const merge = require('webpack-merge')
...
package.json
{
"name": "my-module-name",
"version": "1.0.0-beta.1",
...
Any guidance or assistance would be highly valued. Should additional information be required, please do not hesitate to reach out.