Skip to content
This repository was archived by the owner on Aug 8, 2019. It is now read-only.
This repository was archived by the owner on Aug 8, 2019. It is now read-only.

can DllPlugin and DllReferencePlugin run in browser by use the style of 'commonjs2' instead of 'insert a script tag in html' ? #89

Open

Description

@klouskingsley

I try to use commonjs2 style in DllPlugin and the browser return an error

Uncaught ReferenceError: require is not defined

here is my config files

  • webpack dll config
var webpack = require('webpack')

module.exports = {
    output: {
        path: './dll',
        filename: '[name].js',
        library: '[name]',
        libraryTarget: 'commonjs2'
    },
    entry: {
        test: ['./js/lib/browser.js']
    },
    plugins: [
        new webpack.DllPlugin({
            path: './dll/[name]-manifest.json',
            name: '[name]',
            context: __dirname
        })
    ]
}
  • webpack config fle
var webpack = require('webpack')

module.exports = {
    output: {
        path: __dirname,
        filename: '[name].bundle.js',
    },
    entry: {
        app: ['./app.js']
    },
    plugins: [
        new webpack.DllReferencePlugin({
            manifest: require('./dll/test-manifest.json'),
            context: __dirname,
            sourceType: 'commonjs2',
            name: './dll/test.js'
        })
    ]
}

Activity

  1. captain-yossarian commented on Aug 16, 2018

    @captain-yossarian

    Does somebody find solution here?

  2. yousefallaban commented on Mar 6, 2019

    @yousefallaban

    I had the same error 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions