Optionally disable dynamic import() and use browser native feature

Do you want to request a feature or report a bug?

Feature

What is the current behavior?

import() has been supported by modern browsers such as Safari and Chrome.
However import(url) will cause an error when building with webpack.

For example

import('https://connect.facebook.net/ja_JP/sdk.js')
Module not found: Error: Can't resolve 'https://connect.facebook.net/ja_JP/sdk.js' in '/Users/testuser/git/myproject/src/facebookModule.js'

What is the expected behavior?

Maybe something like this

import(/* webpackMode: "native" */ 'https://connect.facebook.net/ja_JP/sdk.js')

Author: Fantashit

1 thought on “Optionally disable dynamic import() and use browser native feature

  1. Can this be used for node apps too - so that a require directive will be allowed to be handled by node (runtime) instead of webpack taking over and including the required code to the bundle?

Comments are closed.