shakapacker 6.6.0 → 7.0.0.rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby-backward-compatibility.yml +43 -0
- data/CHANGELOG.md +50 -4
- data/CONTRIBUTING.md +4 -4
- data/Gemfile.development_dependencies +1 -1
- data/README.md +113 -88
- data/Rakefile +5 -0
- data/config/shakapacker.yml +1 -0
- data/docs/deployment.md +12 -10
- data/docs/developing_webpacker.md +5 -5
- data/docs/react.md +10 -6
- data/docs/style_loader_vs_mini_css.md +2 -2
- data/docs/troubleshooting.md +22 -18
- data/docs/using_esbuild_loader.md +5 -3
- data/docs/using_swc_loader.md +2 -2
- data/docs/v6_upgrade.md +2 -2
- data/docs/v7_upgrade.md +56 -0
- data/lib/install/bin/shakapacker +13 -0
- data/lib/install/bin/shakapacker-dev-server +13 -0
- data/lib/install/config/{webpacker.yml → shakapacker.yml} +13 -8
- data/lib/install/template.rb +7 -7
- data/lib/{webpacker → shakapacker}/base_strategy.rb +2 -2
- data/lib/{webpacker → shakapacker}/commands.rb +4 -4
- data/lib/{webpacker → shakapacker}/compiler.rb +43 -15
- data/lib/{webpacker → shakapacker}/compiler_strategy.rb +6 -6
- data/lib/{webpacker → shakapacker}/configuration.rb +52 -21
- data/lib/shakapacker/deprecation_helper.rb +88 -0
- data/lib/{webpacker → shakapacker}/dev_server.rb +27 -4
- data/lib/{webpacker → shakapacker}/dev_server_proxy.rb +4 -4
- data/lib/shakapacker/dev_server_runner.rb +104 -0
- data/lib/{webpacker → shakapacker}/digest_strategy.rb +6 -6
- data/lib/{webpacker → shakapacker}/env.rb +8 -8
- data/lib/{webpacker → shakapacker}/helper.rb +20 -20
- data/lib/{webpacker → shakapacker}/instance.rb +13 -10
- data/lib/{webpacker → shakapacker}/manifest.rb +14 -14
- data/lib/{webpacker → shakapacker}/mtime_strategy.rb +5 -5
- data/lib/shakapacker/railtie.rb +70 -0
- data/lib/shakapacker/runner.rb +28 -0
- data/lib/shakapacker/utils/version_syntax_converter.rb +2 -2
- data/lib/{webpacker → shakapacker}/version.rb +2 -2
- data/lib/{webpacker → shakapacker}/version_checker.rb +8 -8
- data/lib/shakapacker/webpack_runner.rb +67 -0
- data/lib/shakapacker.rb +51 -1
- data/lib/tasks/shakapacker/binstubs.rake +15 -0
- data/lib/tasks/shakapacker/check_binstubs.rake +25 -0
- data/lib/tasks/shakapacker/check_node.rake +31 -0
- data/lib/tasks/shakapacker/check_yarn.rake +33 -0
- data/lib/tasks/shakapacker/clean.rake +23 -0
- data/lib/tasks/shakapacker/clobber.rake +18 -0
- data/lib/tasks/shakapacker/compile.rake +31 -0
- data/lib/tasks/shakapacker/info.rake +21 -0
- data/lib/tasks/shakapacker/install.rake +17 -0
- data/lib/tasks/shakapacker/verify_config.rake +12 -0
- data/lib/tasks/shakapacker/verify_install.rake +4 -0
- data/lib/tasks/shakapacker/yarn_install.rake +24 -0
- data/lib/tasks/shakapacker.rake +18 -0
- data/lib/tasks/webpacker/binstubs.rake +5 -11
- data/lib/tasks/webpacker/check_binstubs.rake +6 -9
- data/lib/tasks/webpacker/check_node.rake +5 -27
- data/lib/tasks/webpacker/check_yarn.rake +5 -29
- data/lib/tasks/webpacker/clean.rake +5 -19
- data/lib/tasks/webpacker/clobber.rake +6 -13
- data/lib/tasks/webpacker/compile.rake +5 -33
- data/lib/tasks/webpacker/info.rake +5 -17
- data/lib/tasks/webpacker/install.rake +5 -13
- data/lib/tasks/webpacker/verify_config.rake +6 -11
- data/lib/tasks/webpacker/verify_install.rake +7 -2
- data/lib/tasks/webpacker/yarn_install.rake +5 -20
- data/lib/tasks/webpacker.rake +15 -13
- data/lib/webpacker/dev_server_runner.rb +9 -96
- data/lib/webpacker/webpack_runner.rb +9 -58
- data/lib/webpacker.rb +3 -47
- data/package/__tests__/config-bc.js +27 -0
- data/package/__tests__/config.js +6 -5
- data/package/__tests__/dev_server-bc.js +46 -0
- data/package/__tests__/dev_server.js +9 -8
- data/package/__tests__/development-bc.js +66 -0
- data/package/__tests__/development.js +36 -5
- data/package/__tests__/env-bc.js +59 -0
- data/package/__tests__/env.js +3 -2
- data/package/__tests__/index.js +13 -0
- data/package/__tests__/production-bc.js +51 -0
- data/package/__tests__/production.js +25 -3
- data/package/__tests__/staging-bc.js +53 -0
- data/package/__tests__/staging.js +27 -4
- data/package/__tests__/test-bc.js +43 -0
- data/package/__tests__/test.js +22 -4
- data/package/babel/preset.js +1 -4
- data/package/config.js +25 -7
- data/package/dev_server.js +7 -4
- data/package/env.js +22 -3
- data/package/environments/__tests__/base-bc.js +107 -0
- data/package/environments/__tests__/base.js +13 -13
- data/package/environments/base.js +1 -1
- data/package/environments/development.js +4 -46
- data/package/environments/production.js +1 -1
- data/package/index.js +11 -4
- data/package/rules/__tests__/__utils__/webpack.js +1 -1
- data/package/rules/__tests__/file.js +27 -0
- data/package/rules/__tests__/swc.js +1 -2
- data/package/rules/file.js +2 -2
- data/package/utils/configPath.js +19 -0
- data/package/utils/defaultConfigPath.js +2 -0
- data/package/utils/get_style_rule.js +5 -2
- data/package/utils/helpers.js +24 -1
- data/package/utils/inliningCss.js +7 -0
- data/package/utils/snakeToCamelCase +7 -0
- data/package/webpackDevServerConfig.js +68 -0
- data/package.json +2 -2
- data/{webpacker.gemspec → shakapacker.gemspec} +3 -3
- data/spec/backward_compatibility_specs/command_spec_bc.rb +116 -0
- data/spec/backward_compatibility_specs/compiler_spec_bc.rb +59 -0
- data/spec/backward_compatibility_specs/compiler_strategy_spec_bc.rb +22 -0
- data/spec/backward_compatibility_specs/configuration_spec_bc.rb +286 -0
- data/spec/backward_compatibility_specs/dev_server_runner_spec_bc.rb +79 -0
- data/spec/backward_compatibility_specs/dev_server_spec_bc.rb +47 -0
- data/spec/backward_compatibility_specs/digest_strategy_spec_bc.rb +35 -0
- data/spec/backward_compatibility_specs/engine_rake_tasks_spec_bc.rb +44 -0
- data/spec/backward_compatibility_specs/env_spec_bc.rb +23 -0
- data/spec/backward_compatibility_specs/helper_spec_bc.rb +243 -0
- data/spec/backward_compatibility_specs/instance_spec_bc.rb +31 -0
- data/spec/backward_compatibility_specs/manifest_spec_bc.rb +100 -0
- data/spec/backward_compatibility_specs/mtime_strategy_spec_bc.rb +55 -0
- data/spec/backward_compatibility_specs/rake_tasks_spec_bc.rb +37 -0
- data/spec/backward_compatibility_specs/spec_helper_initializer.rb +24 -0
- data/spec/backward_compatibility_specs/webpack_runner_spec_bc.rb +56 -0
- data/spec/backward_compatibility_specs/webpacker_spec_bc.rb +41 -0
- data/spec/backward_compatibility_specs/webpacker_test_app/.gitignore +2 -0
- data/spec/backward_compatibility_specs/webpacker_test_app/Rakefile +3 -0
- data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/app/packs/entrypoints/application.js +1 -1
- data/{lib/install → spec/backward_compatibility_specs/webpacker_test_app}/bin/webpacker +0 -0
- data/spec/backward_compatibility_specs/webpacker_test_app/config/application.rb +11 -0
- data/spec/backward_compatibility_specs/webpacker_test_app/config/environment.rb +4 -0
- data/spec/backward_compatibility_specs/webpacker_test_app/config/initializers/inspect_autoload_paths.rb +1 -0
- data/spec/backward_compatibility_specs/webpacker_test_app/config/webpack/webpack.config.js +0 -0
- data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/config/webpacker.yml +1 -1
- data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/config/webpacker_css_extract_ignore_order_warnings.yml +1 -1
- data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/config/webpacker_defaults_fallback.yml +1 -1
- data/spec/backward_compatibility_specs/webpacker_test_app/config/webpacker_no_precompile.yml +7 -0
- data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/config/webpacker_other_location.yml +1 -1
- data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/config/webpacker_public_root.yml +1 -1
- data/spec/backward_compatibility_specs/webpacker_test_app/config.ru +5 -0
- data/spec/backward_compatibility_specs/webpacker_test_app/package.json +13 -0
- data/spec/backward_compatibility_specs/webpacker_test_app/public/packs/manifest.json +58 -0
- data/spec/backward_compatibility_specs/webpacker_test_app/some.config.js +0 -0
- data/spec/backward_compatibility_specs/webpacker_test_app/tmp/shakapacker/last-compilation-digest-production +1 -0
- data/spec/backward_compatibility_specs/webpacker_test_app/yarn.lock +11 -0
- data/spec/command_spec.rb +18 -16
- data/spec/compiler_spec.rb +19 -17
- data/spec/compiler_strategy_spec.rb +9 -7
- data/spec/configuration_spec.rb +108 -66
- data/spec/dev_server_runner_spec.rb +9 -8
- data/spec/dev_server_spec.rb +97 -9
- data/spec/digest_strategy_spec.rb +4 -2
- data/spec/engine_rake_tasks_spec.rb +12 -16
- data/spec/env_spec.rb +7 -5
- data/spec/helper_spec.rb +4 -2
- data/spec/instance_spec.rb +31 -0
- data/spec/manifest_spec.rb +21 -19
- data/spec/mounted_app/test/dummy/config/application.rb +1 -1
- data/spec/mounted_app/test/dummy/config/webpacker.yml +3 -3
- data/spec/mtime_strategy_spec.rb +4 -2
- data/spec/rake_tasks_spec.rb +20 -18
- data/spec/spec_helper.rb +0 -25
- data/spec/spec_helper_initializer.rb +24 -0
- data/spec/test_app/.gitignore +2 -0
- data/spec/test_app/app/javascript/entrypoints/application.js +10 -0
- data/spec/test_app/app/javascript/entrypoints/generated/something.js +2 -0
- data/spec/test_app/app/javascript/entrypoints/multi_entry.css +4 -0
- data/spec/test_app/app/javascript/entrypoints/multi_entry.js +4 -0
- data/spec/test_app/bin/{webpacker-dev-server → shakapacker} +3 -3
- data/spec/test_app/bin/{webpacker → shakapacker-dev-server} +3 -3
- data/spec/test_app/config/application.rb +1 -1
- data/spec/test_app/config/shakapacker.yml +82 -0
- data/spec/test_app/config/shakapacker_css_extract_ignore_order_warnings.yml +84 -0
- data/spec/test_app/config/shakapacker_defaults_fallback.yml +11 -0
- data/spec/test_app/config/shakapacker_manifest_path.yml +80 -0
- data/spec/test_app/config/shakapacker_nested_entries.yml +83 -0
- data/spec/test_app/config/shakapacker_no_precompile.yml +7 -0
- data/spec/test_app/config/shakapacker_other_location.yml +85 -0
- data/spec/test_app/config/shakapacker_public_root.yml +18 -0
- data/spec/version_checker_spec.rb +16 -15
- data/spec/webpack_runner_spec.rb +4 -3
- data/spec/webpacker_spec.rb +9 -29
- metadata +119 -44
- data/config/webpacker.yml +0 -1
- data/lib/webpacker/railtie.rb +0 -70
- data/lib/webpacker/runner.rb +0 -23
- data/package/configPath.js +0 -3
- data/package/inliningCss.js +0 -7
- data/spec/test_app/config/webpacker_no_precompile.yml +0 -7
- /data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/app/packs/entrypoints/generated/something.js +0 -0
- /data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/app/packs/entrypoints/multi_entry.css +0 -0
- /data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/app/packs/entrypoints/multi_entry.js +0 -0
- /data/{lib/install → spec/backward_compatibility_specs/webpacker_test_app}/bin/webpacker-dev-server +0 -0
- /data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/config/webpacker_manifest_path.yml +0 -0
- /data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/config/webpacker_nested_entries.yml +0 -0
data/package/__tests__/config.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/* global test expect, describe */
|
|
2
2
|
|
|
3
|
-
const {
|
|
3
|
+
const { chdirTestApp, resetEnv } = require('../utils/helpers')
|
|
4
4
|
const { resolve } = require('path')
|
|
5
5
|
|
|
6
|
+
const rootPath = process.cwd()
|
|
6
7
|
chdirTestApp()
|
|
7
8
|
|
|
8
9
|
const config = require('../config')
|
|
9
10
|
|
|
10
11
|
describe('Config', () => {
|
|
11
12
|
beforeEach(() => jest.resetModules() && resetEnv())
|
|
12
|
-
afterAll(
|
|
13
|
+
afterAll(() => process.chdir(rootPath))
|
|
13
14
|
|
|
14
15
|
test('public path', () => {
|
|
15
16
|
process.env.RAILS_ENV = 'development'
|
|
@@ -19,7 +20,7 @@ describe('Config', () => {
|
|
|
19
20
|
|
|
20
21
|
test('public path with asset host', () => {
|
|
21
22
|
process.env.RAILS_ENV = 'development'
|
|
22
|
-
process.env.
|
|
23
|
+
process.env.SHAKAPACKER_ASSET_HOST = 'http://foo.com/'
|
|
23
24
|
const config = require('../config')
|
|
24
25
|
expect(config.publicPath).toEqual('http://foo.com/packs/')
|
|
25
26
|
})
|
|
@@ -38,8 +39,8 @@ describe('Config', () => {
|
|
|
38
39
|
})
|
|
39
40
|
|
|
40
41
|
test('should allow overriding manifestPath', () => {
|
|
41
|
-
process.env.
|
|
42
|
+
process.env.SHAKAPACKER_CONFIG = 'config/shakapacker_manifest_path.yml'
|
|
42
43
|
const config = require('../config')
|
|
43
|
-
expect(config.manifestPath).toEqual(resolve('app/
|
|
44
|
+
expect(config.manifestPath).toEqual(resolve('app/javascript/manifest.json'))
|
|
44
45
|
})
|
|
45
46
|
})
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* global test expect, describe */
|
|
2
|
+
|
|
3
|
+
const { chdirWebpackerTestApp } = require('../utils/helpers')
|
|
4
|
+
|
|
5
|
+
const rootPath = process.cwd()
|
|
6
|
+
chdirWebpackerTestApp()
|
|
7
|
+
|
|
8
|
+
describe('Backward Compatibility - DevServer', () => {
|
|
9
|
+
beforeEach(() => jest.resetModules())
|
|
10
|
+
afterAll(() => process.chdir(rootPath))
|
|
11
|
+
|
|
12
|
+
test('with NODE_ENV and RAILS_ENV set to development', () => {
|
|
13
|
+
process.env.NODE_ENV = 'development'
|
|
14
|
+
process.env.RAILS_ENV = 'development'
|
|
15
|
+
process.env.WEBPACKER_DEV_SERVER_HOST = '0.0.0.0'
|
|
16
|
+
process.env.WEBPACKER_DEV_SERVER_PORT = 5000
|
|
17
|
+
process.env.WEBPACKER_DEV_SERVER_DISABLE_HOST_CHECK = false
|
|
18
|
+
|
|
19
|
+
const devServer = require('../dev_server')
|
|
20
|
+
expect(devServer).toBeDefined()
|
|
21
|
+
expect(devServer.host).toEqual('0.0.0.0')
|
|
22
|
+
expect(devServer.port).toEqual('5000')
|
|
23
|
+
expect(devServer.disable_host_check).toBe(false)
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
test('with custom env prefix', () => {
|
|
27
|
+
const config = require('../config')
|
|
28
|
+
config.dev_server.env_prefix = 'TEST_WEBPACKER_DEV_SERVER'
|
|
29
|
+
|
|
30
|
+
process.env.NODE_ENV = 'development'
|
|
31
|
+
process.env.RAILS_ENV = 'development'
|
|
32
|
+
process.env.TEST_WEBPACKER_DEV_SERVER_HOST = '0.0.0.0'
|
|
33
|
+
process.env.TEST_WEBPACKER_DEV_SERVER_PORT = 5000
|
|
34
|
+
|
|
35
|
+
const devServer = require('../dev_server')
|
|
36
|
+
expect(devServer).toBeDefined()
|
|
37
|
+
expect(devServer.host).toEqual('0.0.0.0')
|
|
38
|
+
expect(devServer.port).toEqual('5000')
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
test('with NODE_ENV and RAILS_ENV set to production', () => {
|
|
42
|
+
process.env.RAILS_ENV = 'production'
|
|
43
|
+
process.env.NODE_ENV = 'production'
|
|
44
|
+
expect(require('../dev_server')).toEqual({})
|
|
45
|
+
})
|
|
46
|
+
})
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
/* global test expect, describe */
|
|
2
2
|
|
|
3
|
-
const { chdirTestApp
|
|
3
|
+
const { chdirTestApp } = require('../utils/helpers')
|
|
4
4
|
|
|
5
|
+
const rootPath = process.cwd()
|
|
5
6
|
chdirTestApp()
|
|
6
7
|
|
|
7
8
|
describe('DevServer', () => {
|
|
8
9
|
beforeEach(() => jest.resetModules())
|
|
9
|
-
afterAll(
|
|
10
|
+
afterAll(() => process.chdir(rootPath))
|
|
10
11
|
|
|
11
12
|
test('with NODE_ENV and RAILS_ENV set to development', () => {
|
|
12
13
|
process.env.NODE_ENV = 'development'
|
|
13
14
|
process.env.RAILS_ENV = 'development'
|
|
14
|
-
process.env.
|
|
15
|
-
process.env.
|
|
16
|
-
process.env.
|
|
15
|
+
process.env.SHAKAPACKER_DEV_SERVER_HOST = '0.0.0.0'
|
|
16
|
+
process.env.SHAKAPACKER_DEV_SERVER_PORT = 5000
|
|
17
|
+
process.env.SHAKAPACKER_DEV_SERVER_DISABLE_HOST_CHECK = false
|
|
17
18
|
|
|
18
19
|
const devServer = require('../dev_server')
|
|
19
20
|
expect(devServer).toBeDefined()
|
|
@@ -24,12 +25,12 @@ describe('DevServer', () => {
|
|
|
24
25
|
|
|
25
26
|
test('with custom env prefix', () => {
|
|
26
27
|
const config = require('../config')
|
|
27
|
-
config.dev_server.env_prefix = '
|
|
28
|
+
config.dev_server.env_prefix = 'TEST_SHAKAPACKER_DEV_SERVER'
|
|
28
29
|
|
|
29
30
|
process.env.NODE_ENV = 'development'
|
|
30
31
|
process.env.RAILS_ENV = 'development'
|
|
31
|
-
process.env.
|
|
32
|
-
process.env.
|
|
32
|
+
process.env.TEST_SHAKAPACKER_DEV_SERVER_HOST = '0.0.0.0'
|
|
33
|
+
process.env.TEST_SHAKAPACKER_DEV_SERVER_PORT = 5000
|
|
33
34
|
|
|
34
35
|
const devServer = require('../dev_server')
|
|
35
36
|
expect(devServer).toBeDefined()
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* test expect, describe, afterAll, beforeEach */
|
|
2
|
+
|
|
3
|
+
const { resolve } = require('path')
|
|
4
|
+
const { chdirWebpackerTestApp, resetEnv } = require('../utils/helpers')
|
|
5
|
+
|
|
6
|
+
const rootPath = process.cwd()
|
|
7
|
+
chdirWebpackerTestApp()
|
|
8
|
+
|
|
9
|
+
describe('Backward Compatibility - Development environment', () => {
|
|
10
|
+
beforeEach(() => jest.resetModules() && resetEnv())
|
|
11
|
+
afterAll(() => process.chdir(rootPath))
|
|
12
|
+
|
|
13
|
+
describe('generateWebpackConfig', () => {
|
|
14
|
+
beforeEach(() => jest.resetModules())
|
|
15
|
+
|
|
16
|
+
test('should use development config and environment including devServer if WEBPACK_SERVE', () => {
|
|
17
|
+
process.env.RAILS_ENV = 'development'
|
|
18
|
+
process.env.NODE_ENV = 'development'
|
|
19
|
+
process.env.WEBPACK_SERVE = 'true'
|
|
20
|
+
const { generateWebpackConfig } = require('../index')
|
|
21
|
+
|
|
22
|
+
const webpackConfig = generateWebpackConfig()
|
|
23
|
+
|
|
24
|
+
expect(webpackConfig.output.path).toEqual(resolve('public', 'packs'))
|
|
25
|
+
expect(webpackConfig.output.publicPath).toEqual('/packs/')
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
test('should use development config and environment if WEBPACK_SERVE', () => {
|
|
29
|
+
process.env.RAILS_ENV = 'development'
|
|
30
|
+
process.env.NODE_ENV = 'development'
|
|
31
|
+
process.env.WEBPACK_SERVE = undefined
|
|
32
|
+
const { generateWebpackConfig } = require('../index')
|
|
33
|
+
|
|
34
|
+
const webpackConfig = generateWebpackConfig()
|
|
35
|
+
|
|
36
|
+
expect(webpackConfig.output.path).toEqual(resolve('public', 'packs'))
|
|
37
|
+
expect(webpackConfig.output.publicPath).toEqual('/packs/')
|
|
38
|
+
expect(webpackConfig.devServer).toEqual(undefined)
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
describe('globalMutableWebpackConfig', () => {
|
|
43
|
+
beforeEach(() => jest.resetModules())
|
|
44
|
+
|
|
45
|
+
test('should use development config and environment including devServer if WEBPACK_SERVE', () => {
|
|
46
|
+
process.env.RAILS_ENV = 'development'
|
|
47
|
+
process.env.NODE_ENV = 'development'
|
|
48
|
+
process.env.WEBPACK_SERVE = 'true'
|
|
49
|
+
const { globalMutableWebpackConfig: webpackConfig } = require('../index')
|
|
50
|
+
|
|
51
|
+
expect(webpackConfig.output.path).toEqual(resolve('public', 'packs'))
|
|
52
|
+
expect(webpackConfig.output.publicPath).toEqual('/packs/')
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
test('should use development config and environment if WEBPACK_SERVE', () => {
|
|
56
|
+
process.env.RAILS_ENV = 'development'
|
|
57
|
+
process.env.NODE_ENV = 'development'
|
|
58
|
+
process.env.WEBPACK_SERVE = undefined
|
|
59
|
+
const { globalMutableWebpackConfig: webpackConfig } = require('../index')
|
|
60
|
+
|
|
61
|
+
expect(webpackConfig.output.path).toEqual(resolve('public', 'packs'))
|
|
62
|
+
expect(webpackConfig.output.publicPath).toEqual('/packs/')
|
|
63
|
+
expect(webpackConfig.devServer).toEqual(undefined)
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
})
|
|
@@ -1,21 +1,52 @@
|
|
|
1
1
|
/* test expect, describe, afterAll, beforeEach */
|
|
2
2
|
|
|
3
3
|
const { resolve } = require('path')
|
|
4
|
-
const { chdirTestApp,
|
|
4
|
+
const { chdirTestApp, resetEnv } = require('../utils/helpers')
|
|
5
5
|
|
|
6
|
+
const rootPath = process.cwd()
|
|
6
7
|
chdirTestApp()
|
|
7
8
|
|
|
8
9
|
describe('Development environment', () => {
|
|
9
|
-
|
|
10
|
+
beforeEach(() => jest.resetModules() && resetEnv())
|
|
11
|
+
afterAll(() => process.chdir(rootPath))
|
|
10
12
|
|
|
11
|
-
describe('
|
|
13
|
+
describe('generateWebpackConfig', () => {
|
|
12
14
|
beforeEach(() => jest.resetModules())
|
|
13
15
|
|
|
14
16
|
test('should use development config and environment including devServer if WEBPACK_SERVE', () => {
|
|
15
17
|
process.env.RAILS_ENV = 'development'
|
|
16
18
|
process.env.NODE_ENV = 'development'
|
|
17
19
|
process.env.WEBPACK_SERVE = 'true'
|
|
18
|
-
const {
|
|
20
|
+
const { generateWebpackConfig } = require('../index')
|
|
21
|
+
|
|
22
|
+
const webpackConfig = generateWebpackConfig()
|
|
23
|
+
|
|
24
|
+
expect(webpackConfig.output.path).toEqual(resolve('public', 'packs'))
|
|
25
|
+
expect(webpackConfig.output.publicPath).toEqual('/packs/')
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
test('should use development config and environment if WEBPACK_SERVE', () => {
|
|
29
|
+
process.env.RAILS_ENV = 'development'
|
|
30
|
+
process.env.NODE_ENV = 'development'
|
|
31
|
+
process.env.WEBPACK_SERVE = undefined
|
|
32
|
+
const { generateWebpackConfig } = require('../index')
|
|
33
|
+
|
|
34
|
+
const webpackConfig = generateWebpackConfig()
|
|
35
|
+
|
|
36
|
+
expect(webpackConfig.output.path).toEqual(resolve('public', 'packs'))
|
|
37
|
+
expect(webpackConfig.output.publicPath).toEqual('/packs/')
|
|
38
|
+
expect(webpackConfig.devServer).toEqual(undefined)
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
describe('globalMutableWebpackConfig', () => {
|
|
43
|
+
beforeEach(() => jest.resetModules())
|
|
44
|
+
|
|
45
|
+
test('should use development config and environment including devServer if WEBPACK_SERVE', () => {
|
|
46
|
+
process.env.RAILS_ENV = 'development'
|
|
47
|
+
process.env.NODE_ENV = 'development'
|
|
48
|
+
process.env.WEBPACK_SERVE = 'true'
|
|
49
|
+
const { globalMutableWebpackConfig: webpackConfig } = require('../index')
|
|
19
50
|
|
|
20
51
|
expect(webpackConfig.output.path).toEqual(resolve('public', 'packs'))
|
|
21
52
|
expect(webpackConfig.output.publicPath).toEqual('/packs/')
|
|
@@ -25,7 +56,7 @@ describe('Development environment', () => {
|
|
|
25
56
|
process.env.RAILS_ENV = 'development'
|
|
26
57
|
process.env.NODE_ENV = 'development'
|
|
27
58
|
process.env.WEBPACK_SERVE = undefined
|
|
28
|
-
const { webpackConfig } = require('../index')
|
|
59
|
+
const { globalMutableWebpackConfig: webpackConfig } = require('../index')
|
|
29
60
|
|
|
30
61
|
expect(webpackConfig.output.path).toEqual(resolve('public', 'packs'))
|
|
31
62
|
expect(webpackConfig.output.publicPath).toEqual('/packs/')
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* global test expect, describe */
|
|
2
|
+
|
|
3
|
+
const { chdirWebpackerTestApp, resetEnv } = require('../utils/helpers')
|
|
4
|
+
|
|
5
|
+
const rootPath = process.cwd()
|
|
6
|
+
chdirWebpackerTestApp()
|
|
7
|
+
|
|
8
|
+
describe('Backward Compatibility - Env', () => {
|
|
9
|
+
beforeEach(() => jest.resetModules() && resetEnv())
|
|
10
|
+
afterAll(() => process.chdir(rootPath))
|
|
11
|
+
|
|
12
|
+
test('with NODE_ENV and RAILS_ENV set to development', () => {
|
|
13
|
+
process.env.RAILS_ENV = 'development'
|
|
14
|
+
process.env.NODE_ENV = 'development'
|
|
15
|
+
expect(require('../env')).toEqual({
|
|
16
|
+
railsEnv: 'development',
|
|
17
|
+
nodeEnv: 'development',
|
|
18
|
+
isProduction: false,
|
|
19
|
+
isDevelopment: true,
|
|
20
|
+
runningWebpackDevServer: false
|
|
21
|
+
})
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
test('with undefined NODE_ENV and RAILS_ENV set to development', () => {
|
|
25
|
+
process.env.RAILS_ENV = 'development'
|
|
26
|
+
delete process.env.NODE_ENV
|
|
27
|
+
expect(require('../env')).toEqual({
|
|
28
|
+
railsEnv: 'development',
|
|
29
|
+
nodeEnv: 'production',
|
|
30
|
+
isProduction: true,
|
|
31
|
+
isDevelopment: false,
|
|
32
|
+
runningWebpackDevServer: false
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
test('with undefined NODE_ENV and RAILS_ENV', () => {
|
|
37
|
+
delete process.env.NODE_ENV
|
|
38
|
+
delete process.env.RAILS_ENV
|
|
39
|
+
expect(require('../env')).toEqual({
|
|
40
|
+
railsEnv: 'production',
|
|
41
|
+
nodeEnv: 'production',
|
|
42
|
+
isProduction: true,
|
|
43
|
+
isDevelopment: false,
|
|
44
|
+
runningWebpackDevServer: false
|
|
45
|
+
})
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
test('with a non-standard environment', () => {
|
|
49
|
+
process.env.RAILS_ENV = 'staging'
|
|
50
|
+
process.env.NODE_ENV = 'staging'
|
|
51
|
+
expect(require('../env')).toEqual({
|
|
52
|
+
railsEnv: 'staging',
|
|
53
|
+
nodeEnv: 'production',
|
|
54
|
+
isProduction: true,
|
|
55
|
+
isDevelopment: false,
|
|
56
|
+
runningWebpackDevServer: false
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
})
|
data/package/__tests__/env.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/* global test expect, describe */
|
|
2
2
|
|
|
3
|
-
const { chdirTestApp
|
|
3
|
+
const { chdirTestApp } = require('../utils/helpers')
|
|
4
4
|
|
|
5
|
+
const rootPath = process.cwd()
|
|
5
6
|
chdirTestApp()
|
|
6
7
|
|
|
7
8
|
describe('Env', () => {
|
|
8
9
|
beforeEach(() => jest.resetModules())
|
|
9
|
-
afterAll(
|
|
10
|
+
afterAll(() => process.chdir(rootPath))
|
|
10
11
|
|
|
11
12
|
test('with NODE_ENV and RAILS_ENV set to development', () => {
|
|
12
13
|
process.env.RAILS_ENV = 'development'
|
data/package/__tests__/index.js
CHANGED
|
@@ -6,4 +6,17 @@ describe('index', () => {
|
|
|
6
6
|
expect(index.mergeWithRules).toBeInstanceOf(Function)
|
|
7
7
|
expect(index.mergeWithCustomize).toBeInstanceOf(Function)
|
|
8
8
|
})
|
|
9
|
+
|
|
10
|
+
test('webpackConfig returns an immutable object', () => {
|
|
11
|
+
const { generateWebpackConfig } = require('../index')
|
|
12
|
+
|
|
13
|
+
const webpackConfig1 = generateWebpackConfig()
|
|
14
|
+
const webpackConfig2 = generateWebpackConfig()
|
|
15
|
+
|
|
16
|
+
webpackConfig1.newKey = 'new value'
|
|
17
|
+
webpackConfig1.output.path = 'new path'
|
|
18
|
+
|
|
19
|
+
expect(webpackConfig2).not.toHaveProperty('newKey')
|
|
20
|
+
expect(webpackConfig2.output.path).not.toEqual('new value')
|
|
21
|
+
})
|
|
9
22
|
})
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* test expect, describe, afterAll, beforeEach */
|
|
2
|
+
|
|
3
|
+
const { resolve } = require('path')
|
|
4
|
+
const { chdirWebpackerTestApp } = require('../utils/helpers')
|
|
5
|
+
|
|
6
|
+
const rootPath = process.cwd()
|
|
7
|
+
chdirWebpackerTestApp()
|
|
8
|
+
|
|
9
|
+
describe('Backward Compatibility - Production environment', () => {
|
|
10
|
+
afterAll(() => process.chdir(rootPath))
|
|
11
|
+
|
|
12
|
+
describe('generateWebpackConfig', () => {
|
|
13
|
+
beforeEach(() => jest.resetModules())
|
|
14
|
+
|
|
15
|
+
test('should use production config and environment', () => {
|
|
16
|
+
process.env.RAILS_ENV = 'production'
|
|
17
|
+
process.env.NODE_ENV = 'production'
|
|
18
|
+
|
|
19
|
+
const { generateWebpackConfig } = require('../index')
|
|
20
|
+
|
|
21
|
+
const webpackConfig = generateWebpackConfig()
|
|
22
|
+
|
|
23
|
+
expect(webpackConfig.output.path).toEqual(resolve('public', 'packs'))
|
|
24
|
+
expect(webpackConfig.output.publicPath).toEqual('/packs/')
|
|
25
|
+
|
|
26
|
+
expect(webpackConfig).toMatchObject({
|
|
27
|
+
devtool: 'source-map',
|
|
28
|
+
stats: 'normal'
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
describe('globalMutableWebpackConfig', () => {
|
|
34
|
+
beforeEach(() => jest.resetModules())
|
|
35
|
+
|
|
36
|
+
test('should use production config and environment', () => {
|
|
37
|
+
process.env.RAILS_ENV = 'production'
|
|
38
|
+
process.env.NODE_ENV = 'production'
|
|
39
|
+
|
|
40
|
+
const { globalMutableWebpackConfig: webpackConfig } = require('../index')
|
|
41
|
+
|
|
42
|
+
expect(webpackConfig.output.path).toEqual(resolve('public', 'packs'))
|
|
43
|
+
expect(webpackConfig.output.publicPath).toEqual('/packs/')
|
|
44
|
+
|
|
45
|
+
expect(webpackConfig).toMatchObject({
|
|
46
|
+
devtool: 'source-map',
|
|
47
|
+
stats: 'normal'
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
})
|
|
@@ -3,19 +3,41 @@
|
|
|
3
3
|
const { resolve } = require('path')
|
|
4
4
|
const { chdirTestApp, chdirCwd } = require('../utils/helpers')
|
|
5
5
|
|
|
6
|
+
const rootPath = process.cwd()
|
|
6
7
|
chdirTestApp()
|
|
7
8
|
|
|
8
9
|
describe('Production environment', () => {
|
|
9
|
-
afterAll(
|
|
10
|
+
afterAll(() => process.chdir(rootPath))
|
|
10
11
|
|
|
11
|
-
describe('
|
|
12
|
+
describe('generateWebpackConfig', () => {
|
|
12
13
|
beforeEach(() => jest.resetModules())
|
|
13
14
|
|
|
14
15
|
test('should use production config and environment', () => {
|
|
15
16
|
process.env.RAILS_ENV = 'production'
|
|
16
17
|
process.env.NODE_ENV = 'production'
|
|
17
18
|
|
|
18
|
-
const {
|
|
19
|
+
const { generateWebpackConfig } = require('../index')
|
|
20
|
+
|
|
21
|
+
const webpackConfig = generateWebpackConfig()
|
|
22
|
+
|
|
23
|
+
expect(webpackConfig.output.path).toEqual(resolve('public', 'packs'))
|
|
24
|
+
expect(webpackConfig.output.publicPath).toEqual('/packs/')
|
|
25
|
+
|
|
26
|
+
expect(webpackConfig).toMatchObject({
|
|
27
|
+
devtool: 'source-map',
|
|
28
|
+
stats: 'normal'
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
describe('globalMutableWebpackConfig', () => {
|
|
34
|
+
beforeEach(() => jest.resetModules())
|
|
35
|
+
|
|
36
|
+
test('should use production config and environment', () => {
|
|
37
|
+
process.env.RAILS_ENV = 'production'
|
|
38
|
+
process.env.NODE_ENV = 'production'
|
|
39
|
+
|
|
40
|
+
const { globalMutableWebpackConfig: webpackConfig } = require('../index')
|
|
19
41
|
|
|
20
42
|
expect(webpackConfig.output.path).toEqual(resolve('public', 'packs'))
|
|
21
43
|
expect(webpackConfig.output.publicPath).toEqual('/packs/')
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* test expect, describe, afterAll, beforeEach */
|
|
2
|
+
|
|
3
|
+
const { resolve } = require('path')
|
|
4
|
+
const { chdirWebpackerTestApp } = require('../utils/helpers')
|
|
5
|
+
|
|
6
|
+
const rootPath = process.cwd()
|
|
7
|
+
chdirWebpackerTestApp()
|
|
8
|
+
|
|
9
|
+
describe('Backward Compatibility - Custom environment', () => {
|
|
10
|
+
afterAll(() => process.chdir(rootPath))
|
|
11
|
+
|
|
12
|
+
describe('generateWebpackConfig', () => {
|
|
13
|
+
beforeEach(() => jest.resetModules())
|
|
14
|
+
|
|
15
|
+
test('should use staging config and default production environment', () => {
|
|
16
|
+
process.env.RAILS_ENV = 'staging'
|
|
17
|
+
delete process.env.NODE_ENV
|
|
18
|
+
|
|
19
|
+
const { generateWebpackConfig } = require('../index')
|
|
20
|
+
|
|
21
|
+
const webpackConfig = generateWebpackConfig()
|
|
22
|
+
|
|
23
|
+
expect(webpackConfig.output.path).toEqual(
|
|
24
|
+
resolve('public', 'packs-staging')
|
|
25
|
+
)
|
|
26
|
+
expect(webpackConfig.output.publicPath).toEqual('/packs-staging/')
|
|
27
|
+
expect(webpackConfig).toMatchObject({
|
|
28
|
+
devtool: 'source-map',
|
|
29
|
+
stats: 'normal'
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
describe('globalMutableWebpackConfig', () => {
|
|
35
|
+
beforeEach(() => jest.resetModules())
|
|
36
|
+
|
|
37
|
+
test('should use staging config and default production environment', () => {
|
|
38
|
+
process.env.RAILS_ENV = 'staging'
|
|
39
|
+
delete process.env.NODE_ENV
|
|
40
|
+
|
|
41
|
+
const { globalMutableWebpackConfig: webpackConfig } = require('../index')
|
|
42
|
+
|
|
43
|
+
expect(webpackConfig.output.path).toEqual(
|
|
44
|
+
resolve('public', 'packs-staging')
|
|
45
|
+
)
|
|
46
|
+
expect(webpackConfig.output.publicPath).toEqual('/packs-staging/')
|
|
47
|
+
expect(webpackConfig).toMatchObject({
|
|
48
|
+
devtool: 'source-map',
|
|
49
|
+
stats: 'normal'
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
})
|
|
@@ -1,21 +1,44 @@
|
|
|
1
1
|
/* test expect, describe, afterAll, beforeEach */
|
|
2
2
|
|
|
3
3
|
const { resolve } = require('path')
|
|
4
|
-
const { chdirTestApp
|
|
4
|
+
const { chdirTestApp } = require('../utils/helpers')
|
|
5
5
|
|
|
6
|
+
const rootPath = process.cwd()
|
|
6
7
|
chdirTestApp()
|
|
7
8
|
|
|
8
9
|
describe('Custom environment', () => {
|
|
9
|
-
afterAll(
|
|
10
|
+
afterAll(() => process.chdir(rootPath))
|
|
10
11
|
|
|
11
|
-
describe('
|
|
12
|
+
describe('generateWebpackConfig', () => {
|
|
12
13
|
beforeEach(() => jest.resetModules())
|
|
13
14
|
|
|
14
15
|
test('should use staging config and default production environment', () => {
|
|
15
16
|
process.env.RAILS_ENV = 'staging'
|
|
16
17
|
delete process.env.NODE_ENV
|
|
17
18
|
|
|
18
|
-
const {
|
|
19
|
+
const { generateWebpackConfig } = require('../index')
|
|
20
|
+
|
|
21
|
+
const webpackConfig = generateWebpackConfig()
|
|
22
|
+
|
|
23
|
+
expect(webpackConfig.output.path).toEqual(
|
|
24
|
+
resolve('public', 'packs-staging')
|
|
25
|
+
)
|
|
26
|
+
expect(webpackConfig.output.publicPath).toEqual('/packs-staging/')
|
|
27
|
+
expect(webpackConfig).toMatchObject({
|
|
28
|
+
devtool: 'source-map',
|
|
29
|
+
stats: 'normal'
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
describe('globalMutableWebpackConfig', () => {
|
|
35
|
+
beforeEach(() => jest.resetModules())
|
|
36
|
+
|
|
37
|
+
test('should use staging config and default production environment', () => {
|
|
38
|
+
process.env.RAILS_ENV = 'staging'
|
|
39
|
+
delete process.env.NODE_ENV
|
|
40
|
+
|
|
41
|
+
const { globalMutableWebpackConfig: webpackConfig } = require('../index')
|
|
19
42
|
|
|
20
43
|
expect(webpackConfig.output.path).toEqual(
|
|
21
44
|
resolve('public', 'packs-staging')
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* test expect, describe, afterAll, beforeEach */
|
|
2
|
+
|
|
3
|
+
const { resolve } = require('path')
|
|
4
|
+
const { chdirWebpackerTestApp } = require('../utils/helpers')
|
|
5
|
+
|
|
6
|
+
const rootPath = process.cwd()
|
|
7
|
+
chdirWebpackerTestApp()
|
|
8
|
+
|
|
9
|
+
describe('Backward Compatibility - Test environment', () => {
|
|
10
|
+
afterAll(() => process.chdir(rootPath))
|
|
11
|
+
|
|
12
|
+
describe('toWebpackConfig', () => {
|
|
13
|
+
beforeEach(() => jest.resetModules())
|
|
14
|
+
|
|
15
|
+
test('should use test config and production environment', () => {
|
|
16
|
+
process.env.RAILS_ENV = 'test'
|
|
17
|
+
process.env.NODE_ENV = 'test'
|
|
18
|
+
|
|
19
|
+
const { generateWebpackConfig } = require('../index')
|
|
20
|
+
|
|
21
|
+
const webpackConfig = generateWebpackConfig()
|
|
22
|
+
|
|
23
|
+
expect(webpackConfig.output.path).toEqual(resolve('public', 'packs-test'))
|
|
24
|
+
expect(webpackConfig.output.publicPath).toEqual('/packs-test/')
|
|
25
|
+
expect(webpackConfig.devServer).toEqual(undefined)
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
describe('globalMutableWebpackConfig', () => {
|
|
30
|
+
beforeEach(() => jest.resetModules())
|
|
31
|
+
|
|
32
|
+
test('should use test config and production environment', () => {
|
|
33
|
+
process.env.RAILS_ENV = 'test'
|
|
34
|
+
process.env.NODE_ENV = 'test'
|
|
35
|
+
|
|
36
|
+
const { globalMutableWebpackConfig: webpackConfig } = require('../index')
|
|
37
|
+
|
|
38
|
+
expect(webpackConfig.output.path).toEqual(resolve('public', 'packs-test'))
|
|
39
|
+
expect(webpackConfig.output.publicPath).toEqual('/packs-test/')
|
|
40
|
+
expect(webpackConfig.devServer).toEqual(undefined)
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
})
|
data/package/__tests__/test.js
CHANGED
|
@@ -1,21 +1,39 @@
|
|
|
1
1
|
/* test expect, describe, afterAll, beforeEach */
|
|
2
2
|
|
|
3
3
|
const { resolve } = require('path')
|
|
4
|
-
const { chdirTestApp
|
|
4
|
+
const { chdirTestApp } = require('../utils/helpers')
|
|
5
5
|
|
|
6
|
+
const rootPath = process.cwd()
|
|
6
7
|
chdirTestApp()
|
|
7
8
|
|
|
8
9
|
describe('Test environment', () => {
|
|
9
|
-
afterAll(
|
|
10
|
+
afterAll(() => process.chdir(rootPath))
|
|
10
11
|
|
|
11
|
-
describe('
|
|
12
|
+
describe('generateWebpackConfig', () => {
|
|
12
13
|
beforeEach(() => jest.resetModules())
|
|
13
14
|
|
|
14
15
|
test('should use test config and production environment', () => {
|
|
15
16
|
process.env.RAILS_ENV = 'test'
|
|
16
17
|
process.env.NODE_ENV = 'test'
|
|
17
18
|
|
|
18
|
-
const {
|
|
19
|
+
const { generateWebpackConfig } = require('../index')
|
|
20
|
+
|
|
21
|
+
const webpackConfig = generateWebpackConfig()
|
|
22
|
+
|
|
23
|
+
expect(webpackConfig.output.path).toEqual(resolve('public', 'packs-test'))
|
|
24
|
+
expect(webpackConfig.output.publicPath).toEqual('/packs-test/')
|
|
25
|
+
expect(webpackConfig.devServer).toEqual(undefined)
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
describe('globalMutableWebpackConfig', () => {
|
|
30
|
+
beforeEach(() => jest.resetModules())
|
|
31
|
+
|
|
32
|
+
test('should use test config and production environment', () => {
|
|
33
|
+
process.env.RAILS_ENV = 'test'
|
|
34
|
+
process.env.NODE_ENV = 'test'
|
|
35
|
+
|
|
36
|
+
const { globalMutableWebpackConfig: webpackConfig } = require('../index')
|
|
19
37
|
|
|
20
38
|
expect(webpackConfig.output.path).toEqual(resolve('public', 'packs-test'))
|
|
21
39
|
expect(webpackConfig.output.publicPath).toEqual('/packs-test/')
|
data/package/babel/preset.js
CHANGED
|
@@ -28,10 +28,7 @@ module.exports = function config(api) {
|
|
|
28
28
|
exclude: ['transform-typeof-symbol']
|
|
29
29
|
}
|
|
30
30
|
],
|
|
31
|
-
moduleExists('@babel/preset-typescript') &&
|
|
32
|
-
'@babel/preset-typescript',
|
|
33
|
-
{ allExtensions: true, isTSX: true }
|
|
34
|
-
]
|
|
31
|
+
moduleExists('@babel/preset-typescript') && '@babel/preset-typescript'
|
|
35
32
|
].filter(Boolean),
|
|
36
33
|
plugins: [
|
|
37
34
|
['@babel/plugin-transform-runtime', { helpers: false }]
|