Coder Social home page Coder Social logo

Comments (3)

ErikSchierboom avatar ErikSchierboom commented on July 4, 2024

I have the exact same issue. Any ideas?

from expose-loader.

MichaelBuen avatar MichaelBuen commented on July 4, 2024

use webpack.ProvidePlugin

const plugins = [
    new webpack.NamedModulesPlugin(),
    new HtmlWebpackPlugin({
        title: 'Ssk',
        filename: 'index.html',
        template: '../template/index.html',
        // chunksSortMode: 'dependency'
    }),
    new webpack.ProvidePlugin({
        'Promise': 'bluebird'
    })
];


const config = {
    context: path.join(__dirname, 'front-end'),
    entry: entries,
    output: {
        path: path.join(__dirname, 'dist--front-end'),
        filename: '[name].js',
        chunkFilename: '[name].chunk.js'
    },
    // Enable sourcemaps for debugging webpack's output.
    devtool: 'source-map',
    resolve: {
        extensions: ['.ts', '.tsx', '.js', '.jsx'],
        // modules: ['front-end', 'node_modules']
    },
    plugins: plugins,
    module: {
        rules: rules
    },
    devServer: {
        historyApiFallback: {
            index: '/index.html'
        }
    }
};

module.exports = config;

Test code:

// noinspection TsLint
console.log(`bluebird is${!!(Promise as any)['promisifyAll'] ? '': ' not'} available`);

Output:

image

from expose-loader.

d-ph avatar d-ph commented on July 4, 2024

Thanks for your answer, Michael.

I'm closing this ticket because I now use a separate ts/js file where I import all js polyfills I require for the browsers I support. I actually prefer this way of doing this because I can see at a glance what I polyfill in my project without rummaging through the webpack's config file.

Thanks again for your time, though. I appreciate it.

from expose-loader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.