Is there anyone out there who can assist me with this issue?
I am attempting to publish an npm package with the following configuration:
webpack:
production: {
entry: [
'./src',
'./src/app.scss',
'draft-js/dist/Draft.css'
],
devtool: "source-map",
output: {
path: path.join(__dirname, 'lib'),
filename: 'stewie-editor.js',
library: 'stewie-editor',
libraryTarget: 'umd',
umdNamedDefine: true
}
},
package.json section for library publishing
"main": "lib/stewie-editor.js",
"files": [
"lib",
"src"
],
The content of my src/index.js file is as follows:
import EditorComponent from 'EditorComponent';
import EditorFactory from 'EditorFactory';
export {
EditorFactory,
EditorComponent
}
.babelrc
{
"presets": ["es2015", "stage-2", "react"],
"plugins": ["babel-plugin-add-module-exports"],
"env": {
"test": {
"plugins": [
["css-modules-transform", {
"generateScopedName": "[name]__[local]",
"extensions": [".css", ".scss"]
}]
]
},
"dev": {
"plugins": [["react-transform", {
"transforms": [{
"transform": "react-transform-hmr",
"imports": ["react"],
"locals": ["module"]
}]
}]]
}
}
}
I have checked this example where everything works fine.
However, in my current setup, things are not functioning correctly.
In another project, when I install the stewie-editor npm package and import the exported classes like this:
import { EditorFactory } from 'stewie-editor';
I receive 'undefined'. When I try to inspect the whole package by importing it like this:
import stewie from 'stewie-editor';
I get an empty Object.