Skip to content

Instantly share code, notes, and snippets.

@lneveu
Created August 8, 2019 12:54
Show Gist options
  • Save lneveu/b67f5ddcbbfe9330a8bae8a3d360280b to your computer and use it in GitHub Desktop.
Save lneveu/b67f5ddcbbfe9330a8bae8a3d360280b to your computer and use it in GitHub Desktop.
Webpack / Babel loader "eval" issue
module.exports = {
presets: [['@babel/preset-env']],
plugins: [['@babel/plugin-transform-runtime', { absoluteRuntime: true }]]
};
window.f = (o) => {
if (typeof o !== 'object') return eval(o);
};
module.exports = {
entry: './index.js',
mode: 'production',
devtool: 'source-map',
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
}
]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment