forked from MichaelYick/mailpoet
Remove no longer supported import syntax, use CommonJS for tests instead
Using inject-loader requires first transpiling modules to CommonJS. Previously, we were doing this via parametrized imports, but these are no longer supported. Instead, we can fix this by using CommonJS preset in Webpack config. [MAILPOET-5491]
This commit is contained in:
parent
4ed5ce2ba3
commit
924b01d85c
@ -2,10 +2,7 @@ import { App } from 'newsletter-editor/app';
|
||||
import { AutomatedLatestContentBlock } from 'newsletter-editor/blocks/automated-latest-content-layout';
|
||||
import { ContainerBlock } from 'newsletter-editor/blocks/container';
|
||||
import { CommunicationComponent } from 'newsletter-editor/components/communication';
|
||||
|
||||
/* (ES6 -> CommonJS transform needed for inject-loader) */
|
||||
/* eslint-disable-next-line max-len */
|
||||
import AutomatedLatestContentInjector from 'inject-loader!babel-loader?plugins[]=@babel/plugin-transform-modules-commonjs!newsletter-editor/blocks/automated-latest-content-layout';
|
||||
import AutomatedLatestContentInjector from 'inject-loader!newsletter-editor/blocks/automated-latest-content-layout';
|
||||
|
||||
const expect = global.expect;
|
||||
const sinon = global.sinon;
|
||||
|
@ -1,6 +1,4 @@
|
||||
/* (ES6 -> CommonJS transform needed for inject-loader) */
|
||||
/* eslint-disable-next-line max-len */
|
||||
import CommunicationInjector from 'inject-loader!babel-loader?plugins[]=@babel/plugin-transform-modules-commonjs!newsletter-editor/components/communication';
|
||||
import CommunicationInjector from 'inject-loader!newsletter-editor/components/communication';
|
||||
|
||||
const expect = global.expect;
|
||||
const jQuery = global.jQuery;
|
||||
|
@ -1,10 +1,7 @@
|
||||
import { App } from 'newsletter-editor/app';
|
||||
import { SaveComponent } from 'newsletter-editor/components/save';
|
||||
import jQuery from 'jquery';
|
||||
|
||||
/* (ES6 -> CommonJS transform needed for inject-loader) */
|
||||
/* eslint-disable-next-line max-len */
|
||||
import SaveInjector from 'inject-loader!babel-loader?plugins[]=@babel/plugin-transform-modules-commonjs!newsletter-editor/components/save';
|
||||
import SaveInjector from 'inject-loader!newsletter-editor/components/save';
|
||||
|
||||
const expect = global.expect;
|
||||
const sinon = global.sinon;
|
||||
|
@ -295,6 +295,21 @@ const testConfig = {
|
||||
'blocks/text.spec.js',
|
||||
],
|
||||
},
|
||||
module: {
|
||||
...baseConfig.module,
|
||||
rules: [
|
||||
{
|
||||
test: /\.(j|t)sx?$/,
|
||||
exclude: /(node_modules|src\/vendor)/,
|
||||
loader: 'babel-loader',
|
||||
resolve: { fullySpecified: false },
|
||||
options: {
|
||||
presets: [['@babel/preset-env', { modules: 'commonjs' }]],
|
||||
},
|
||||
},
|
||||
...baseConfig.module.rules,
|
||||
],
|
||||
},
|
||||
output: {
|
||||
path: path.join(
|
||||
__dirname,
|
||||
|
Loading…
x
Reference in New Issue
Block a user