Babel 6 to 7 upgrade












1














I have used babel-upgrade, to upgrade our babel/webpack set up, but I get this error.



ModuleNotFoundError: Module not found: Error: Can't resolve 'regenerator-runtime/runtime' in 'C:Users...node_modules@babelpolyfilllib'


This is our package.json



{
"dependencies": {
"@babel/polyfill": "^7.0.0",
"@babel/register": "^7.0.0"
},
"devDependencies": {
"@babel/core": "^7.1.6",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/preset-env": "^7.1.6",
"@babel/preset-react": "^7.0.0",
"@types/webpack": "^4.4.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.6.0",
"babel-loader": "^8.0.4",
"expose-loader": "^0.7.5",
"po-loader": "^0.4.1",
"po2json": "^0.4.5",
"ts-loader": "^5.0.0",
"typescript": "^3.1.4",
"webpack": "^4.17.2",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.3"
},
"babel": {
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-object-rest-spread"
]
}
}


Webpack config



'use strict';
/// <reference types="node" />
const path = require('path');
const fs = require('fs');
const webpack = require('webpack');

/** @type {webpack.Configuration} */
const config = {
bail: true,
mode: 'development',
target: 'web',

entry: {
ravenjs: 'raven-js',
vendor: ['@babel/polyfill', 'whatwg-fetch'],
upload: ['upload/UploadComponent'],
video: 'video/player.ts',
},

resolve: {
modules: [javaScriptSourceDir, typeScriptSourceDir, nodeModules],
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json', 'po'],
},

externals: {
'jquery': 'jquery', // require("jquery") is compiled as runtime require("jquery")
'raven': 'bundle/ravenjs',
},

output: {
path: bundleDir,
filename: '[name].js',
sourceMapFilename: '[file].map',
chunkFilename: 'chunk[id].js',
publicPath: '',
libraryTarget: 'amd'
},

module: {
rules: [
{
// use Babel for source files
test: /.js(x?)$/,
include: javaScriptSourceDir,
use: [{
loader: 'babel-loader',
options: {
cacheDirectory: true,
},
}],
},
{
// compile and transpile .ts files
test: /.ts$/,
use: [
{
loader: 'babel-loader',
options: {
cacheDirectory: true,
},
},
{
loader: 'ts-loader',
options: {
configFile: TSConfigFile,
//useBabel: true,
//useCache: true,
}
},
],
},
{
// *.po -> *.json
test: /.po$/,
include: javaScriptSourceDir,
use: [{
loader: 'po-loader',
options: {
format: 'jed1.x',
},
}],
type: 'json',
}
]
},

plugins: [
new webpack.ProvidePlugin({ React: 'react' }),
],
};
module.exports = config;









share|improve this question
























  • Please add your webpack config, you are probably not referencing properly the regenerator polyfill, either import it somewhere in your scripts or as a separate entry.
    – shayy
    Nov 16 '18 at 12:17










  • @shayy There you go, I have no idea how to configure the regenerator polyfill
    – Akxe
    Nov 16 '18 at 13:32












  • Did you solve your issue? I try to update babel from v6 to v7 in a module I do distribute that need those regenerator. I do not use webpack
    – Dimitri Kopriwa
    Nov 20 '18 at 9:09












  • @DimitriKopriwa i sadly have not, if you do however, write an answer here :)
    – Akxe
    Nov 20 '18 at 17:55






  • 1




    Hi, I finally found why. I had to use @babel/plugin-transform-modules-commonjs when BABEL_ENV=production. It fixed the regenerator error.
    – Dimitri Kopriwa
    Nov 20 '18 at 20:57
















1














I have used babel-upgrade, to upgrade our babel/webpack set up, but I get this error.



ModuleNotFoundError: Module not found: Error: Can't resolve 'regenerator-runtime/runtime' in 'C:Users...node_modules@babelpolyfilllib'


This is our package.json



{
"dependencies": {
"@babel/polyfill": "^7.0.0",
"@babel/register": "^7.0.0"
},
"devDependencies": {
"@babel/core": "^7.1.6",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/preset-env": "^7.1.6",
"@babel/preset-react": "^7.0.0",
"@types/webpack": "^4.4.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.6.0",
"babel-loader": "^8.0.4",
"expose-loader": "^0.7.5",
"po-loader": "^0.4.1",
"po2json": "^0.4.5",
"ts-loader": "^5.0.0",
"typescript": "^3.1.4",
"webpack": "^4.17.2",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.3"
},
"babel": {
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-object-rest-spread"
]
}
}


Webpack config



'use strict';
/// <reference types="node" />
const path = require('path');
const fs = require('fs');
const webpack = require('webpack');

/** @type {webpack.Configuration} */
const config = {
bail: true,
mode: 'development',
target: 'web',

entry: {
ravenjs: 'raven-js',
vendor: ['@babel/polyfill', 'whatwg-fetch'],
upload: ['upload/UploadComponent'],
video: 'video/player.ts',
},

resolve: {
modules: [javaScriptSourceDir, typeScriptSourceDir, nodeModules],
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json', 'po'],
},

externals: {
'jquery': 'jquery', // require("jquery") is compiled as runtime require("jquery")
'raven': 'bundle/ravenjs',
},

output: {
path: bundleDir,
filename: '[name].js',
sourceMapFilename: '[file].map',
chunkFilename: 'chunk[id].js',
publicPath: '',
libraryTarget: 'amd'
},

module: {
rules: [
{
// use Babel for source files
test: /.js(x?)$/,
include: javaScriptSourceDir,
use: [{
loader: 'babel-loader',
options: {
cacheDirectory: true,
},
}],
},
{
// compile and transpile .ts files
test: /.ts$/,
use: [
{
loader: 'babel-loader',
options: {
cacheDirectory: true,
},
},
{
loader: 'ts-loader',
options: {
configFile: TSConfigFile,
//useBabel: true,
//useCache: true,
}
},
],
},
{
// *.po -> *.json
test: /.po$/,
include: javaScriptSourceDir,
use: [{
loader: 'po-loader',
options: {
format: 'jed1.x',
},
}],
type: 'json',
}
]
},

plugins: [
new webpack.ProvidePlugin({ React: 'react' }),
],
};
module.exports = config;









share|improve this question
























  • Please add your webpack config, you are probably not referencing properly the regenerator polyfill, either import it somewhere in your scripts or as a separate entry.
    – shayy
    Nov 16 '18 at 12:17










  • @shayy There you go, I have no idea how to configure the regenerator polyfill
    – Akxe
    Nov 16 '18 at 13:32












  • Did you solve your issue? I try to update babel from v6 to v7 in a module I do distribute that need those regenerator. I do not use webpack
    – Dimitri Kopriwa
    Nov 20 '18 at 9:09












  • @DimitriKopriwa i sadly have not, if you do however, write an answer here :)
    – Akxe
    Nov 20 '18 at 17:55






  • 1




    Hi, I finally found why. I had to use @babel/plugin-transform-modules-commonjs when BABEL_ENV=production. It fixed the regenerator error.
    – Dimitri Kopriwa
    Nov 20 '18 at 20:57














1












1








1







I have used babel-upgrade, to upgrade our babel/webpack set up, but I get this error.



ModuleNotFoundError: Module not found: Error: Can't resolve 'regenerator-runtime/runtime' in 'C:Users...node_modules@babelpolyfilllib'


This is our package.json



{
"dependencies": {
"@babel/polyfill": "^7.0.0",
"@babel/register": "^7.0.0"
},
"devDependencies": {
"@babel/core": "^7.1.6",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/preset-env": "^7.1.6",
"@babel/preset-react": "^7.0.0",
"@types/webpack": "^4.4.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.6.0",
"babel-loader": "^8.0.4",
"expose-loader": "^0.7.5",
"po-loader": "^0.4.1",
"po2json": "^0.4.5",
"ts-loader": "^5.0.0",
"typescript": "^3.1.4",
"webpack": "^4.17.2",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.3"
},
"babel": {
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-object-rest-spread"
]
}
}


Webpack config



'use strict';
/// <reference types="node" />
const path = require('path');
const fs = require('fs');
const webpack = require('webpack');

/** @type {webpack.Configuration} */
const config = {
bail: true,
mode: 'development',
target: 'web',

entry: {
ravenjs: 'raven-js',
vendor: ['@babel/polyfill', 'whatwg-fetch'],
upload: ['upload/UploadComponent'],
video: 'video/player.ts',
},

resolve: {
modules: [javaScriptSourceDir, typeScriptSourceDir, nodeModules],
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json', 'po'],
},

externals: {
'jquery': 'jquery', // require("jquery") is compiled as runtime require("jquery")
'raven': 'bundle/ravenjs',
},

output: {
path: bundleDir,
filename: '[name].js',
sourceMapFilename: '[file].map',
chunkFilename: 'chunk[id].js',
publicPath: '',
libraryTarget: 'amd'
},

module: {
rules: [
{
// use Babel for source files
test: /.js(x?)$/,
include: javaScriptSourceDir,
use: [{
loader: 'babel-loader',
options: {
cacheDirectory: true,
},
}],
},
{
// compile and transpile .ts files
test: /.ts$/,
use: [
{
loader: 'babel-loader',
options: {
cacheDirectory: true,
},
},
{
loader: 'ts-loader',
options: {
configFile: TSConfigFile,
//useBabel: true,
//useCache: true,
}
},
],
},
{
// *.po -> *.json
test: /.po$/,
include: javaScriptSourceDir,
use: [{
loader: 'po-loader',
options: {
format: 'jed1.x',
},
}],
type: 'json',
}
]
},

plugins: [
new webpack.ProvidePlugin({ React: 'react' }),
],
};
module.exports = config;









share|improve this question















I have used babel-upgrade, to upgrade our babel/webpack set up, but I get this error.



ModuleNotFoundError: Module not found: Error: Can't resolve 'regenerator-runtime/runtime' in 'C:Users...node_modules@babelpolyfilllib'


This is our package.json



{
"dependencies": {
"@babel/polyfill": "^7.0.0",
"@babel/register": "^7.0.0"
},
"devDependencies": {
"@babel/core": "^7.1.6",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/preset-env": "^7.1.6",
"@babel/preset-react": "^7.0.0",
"@types/webpack": "^4.4.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.6.0",
"babel-loader": "^8.0.4",
"expose-loader": "^0.7.5",
"po-loader": "^0.4.1",
"po2json": "^0.4.5",
"ts-loader": "^5.0.0",
"typescript": "^3.1.4",
"webpack": "^4.17.2",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.3"
},
"babel": {
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-object-rest-spread"
]
}
}


Webpack config



'use strict';
/// <reference types="node" />
const path = require('path');
const fs = require('fs');
const webpack = require('webpack');

/** @type {webpack.Configuration} */
const config = {
bail: true,
mode: 'development',
target: 'web',

entry: {
ravenjs: 'raven-js',
vendor: ['@babel/polyfill', 'whatwg-fetch'],
upload: ['upload/UploadComponent'],
video: 'video/player.ts',
},

resolve: {
modules: [javaScriptSourceDir, typeScriptSourceDir, nodeModules],
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json', 'po'],
},

externals: {
'jquery': 'jquery', // require("jquery") is compiled as runtime require("jquery")
'raven': 'bundle/ravenjs',
},

output: {
path: bundleDir,
filename: '[name].js',
sourceMapFilename: '[file].map',
chunkFilename: 'chunk[id].js',
publicPath: '',
libraryTarget: 'amd'
},

module: {
rules: [
{
// use Babel for source files
test: /.js(x?)$/,
include: javaScriptSourceDir,
use: [{
loader: 'babel-loader',
options: {
cacheDirectory: true,
},
}],
},
{
// compile and transpile .ts files
test: /.ts$/,
use: [
{
loader: 'babel-loader',
options: {
cacheDirectory: true,
},
},
{
loader: 'ts-loader',
options: {
configFile: TSConfigFile,
//useBabel: true,
//useCache: true,
}
},
],
},
{
// *.po -> *.json
test: /.po$/,
include: javaScriptSourceDir,
use: [{
loader: 'po-loader',
options: {
format: 'jed1.x',
},
}],
type: 'json',
}
]
},

plugins: [
new webpack.ProvidePlugin({ React: 'react' }),
],
};
module.exports = config;






webpack babeljs babel-loader






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 13:28

























asked Nov 16 '18 at 12:01









Akxe

1,22211138




1,22211138












  • Please add your webpack config, you are probably not referencing properly the regenerator polyfill, either import it somewhere in your scripts or as a separate entry.
    – shayy
    Nov 16 '18 at 12:17










  • @shayy There you go, I have no idea how to configure the regenerator polyfill
    – Akxe
    Nov 16 '18 at 13:32












  • Did you solve your issue? I try to update babel from v6 to v7 in a module I do distribute that need those regenerator. I do not use webpack
    – Dimitri Kopriwa
    Nov 20 '18 at 9:09












  • @DimitriKopriwa i sadly have not, if you do however, write an answer here :)
    – Akxe
    Nov 20 '18 at 17:55






  • 1




    Hi, I finally found why. I had to use @babel/plugin-transform-modules-commonjs when BABEL_ENV=production. It fixed the regenerator error.
    – Dimitri Kopriwa
    Nov 20 '18 at 20:57


















  • Please add your webpack config, you are probably not referencing properly the regenerator polyfill, either import it somewhere in your scripts or as a separate entry.
    – shayy
    Nov 16 '18 at 12:17










  • @shayy There you go, I have no idea how to configure the regenerator polyfill
    – Akxe
    Nov 16 '18 at 13:32












  • Did you solve your issue? I try to update babel from v6 to v7 in a module I do distribute that need those regenerator. I do not use webpack
    – Dimitri Kopriwa
    Nov 20 '18 at 9:09












  • @DimitriKopriwa i sadly have not, if you do however, write an answer here :)
    – Akxe
    Nov 20 '18 at 17:55






  • 1




    Hi, I finally found why. I had to use @babel/plugin-transform-modules-commonjs when BABEL_ENV=production. It fixed the regenerator error.
    – Dimitri Kopriwa
    Nov 20 '18 at 20:57
















Please add your webpack config, you are probably not referencing properly the regenerator polyfill, either import it somewhere in your scripts or as a separate entry.
– shayy
Nov 16 '18 at 12:17




Please add your webpack config, you are probably not referencing properly the regenerator polyfill, either import it somewhere in your scripts or as a separate entry.
– shayy
Nov 16 '18 at 12:17












@shayy There you go, I have no idea how to configure the regenerator polyfill
– Akxe
Nov 16 '18 at 13:32






@shayy There you go, I have no idea how to configure the regenerator polyfill
– Akxe
Nov 16 '18 at 13:32














Did you solve your issue? I try to update babel from v6 to v7 in a module I do distribute that need those regenerator. I do not use webpack
– Dimitri Kopriwa
Nov 20 '18 at 9:09






Did you solve your issue? I try to update babel from v6 to v7 in a module I do distribute that need those regenerator. I do not use webpack
– Dimitri Kopriwa
Nov 20 '18 at 9:09














@DimitriKopriwa i sadly have not, if you do however, write an answer here :)
– Akxe
Nov 20 '18 at 17:55




@DimitriKopriwa i sadly have not, if you do however, write an answer here :)
– Akxe
Nov 20 '18 at 17:55




1




1




Hi, I finally found why. I had to use @babel/plugin-transform-modules-commonjs when BABEL_ENV=production. It fixed the regenerator error.
– Dimitri Kopriwa
Nov 20 '18 at 20:57




Hi, I finally found why. I had to use @babel/plugin-transform-modules-commonjs when BABEL_ENV=production. It fixed the regenerator error.
– Dimitri Kopriwa
Nov 20 '18 at 20:57

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53337508%2fbabel-6-to-7-upgrade%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53337508%2fbabel-6-to-7-upgrade%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

ComboBox Display Member on multiple fields

Is it possible to collect Nectar points via Trainline?