I have the following index.js code:
import {Asp} from './src/asp.js';
export default Asp;
and the following run.js code:
import Asp from './dist/bundle.js'; // Uncaught SyntaxError: The requested module does not provide an export named 'default'
import Asp from './index.js'; // works
const myASP = new Asp();
and webpack (3.11) config file:
const path = require('path');
module.exports = {
entry: './index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [
{ test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" }
]
}
};
I can't figure out why using the bundle.js doesn't work when I import...help...
UPDATE:
I gave up on webpack and moved to rollup with the following configuration which solved my problem:
import uglify from 'rollup-plugin-uglify';
export default {
input: 'src/index.js',
output:{
file: 'dist/index.js',
name: 'Asp',
format: 'es'
},
plugins: [
uglify()
]
}
I couldn't figure out what was the equivalent to this in webpack - but it did the job!