Skip to content

Commit 7295cb3

Browse files
authored
Merge pull request #9 from fs-webdev/i18n
Add support for webpack-wci18n
2 parents d328442 + 0e47641 commit 7295cb3

File tree

4 files changed

+82
-56
lines changed

4 files changed

+82
-56
lines changed

CHANGELOG-FRONTIER.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
## 1.0.0
2+
23
Forked Create React [email protected]
34

45
#### :rocket: New Feature
56

7+
- webpack-wci18n support
68
- Got travis to automatically make the tar file and upload it to the github release when a new tag is made (and pushed)
79
- Added a way to get User Input if they want their react app to have support for Polymer or Redux
810
- Added new jest configuration option `transformIgnorePatterns`

packages/react-scripts/config/webpack.config.dev.js

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -277,34 +277,48 @@ module.exports = {
277277
{
278278
test: /\.(js|mjs)$/,
279279
exclude: /@babel(?:\/|\\{1,2})runtime/,
280-
loader: require.resolve('babel-loader'),
281-
options: {
282-
babelrc: false,
283-
configFile: false,
284-
compact: false,
285-
presets: [
286-
[
287-
require.resolve('babel-preset-react-app/dependencies'),
288-
{ helpers: true },
289-
],
290-
],
291-
cacheDirectory: true,
292-
// Don't waste time on Gzipping the cache
293-
cacheCompression: false,
294-
// @remove-on-eject-begin
295-
cacheIdentifier: getCacheIdentifier('development', [
296-
'babel-plugin-named-asset-import',
297-
'babel-preset-react-app',
298-
'react-dev-utils',
299-
'react-scripts',
300-
]),
301-
// @remove-on-eject-end
302-
// If an error happens in a package, it's possible to be
303-
// because it was compiled. Thus, we don't want the browser
304-
// debugger to show the original code. Instead, the code
305-
// being evaluated would be much more helpful.
306-
sourceMaps: false,
307-
},
280+
use: [
281+
{
282+
loader: require.resolve('webpack-wci18n'),
283+
},
284+
{
285+
loader: require.resolve('babel-loader'),
286+
options: {
287+
babelrc: false,
288+
configFile: false,
289+
compact: false,
290+
presets: [
291+
[
292+
require.resolve('babel-preset-react-app/dependencies'),
293+
{ helpers: true },
294+
],
295+
],
296+
plugins: [
297+
[
298+
require.resolve('babel-plugin-bundled-import-meta'),
299+
{ importStyle: 'iife' },
300+
],
301+
],
302+
cacheDirectory: true,
303+
// Don't waste time on Gzipping the cache
304+
cacheCompression: false,
305+
// @remove-on-eject-begin
306+
cacheIdentifier: getCacheIdentifier('development', [
307+
'babel-plugin-bundled-import-meta',
308+
'babel-plugin-named-asset-import',
309+
'babel-preset-react-app',
310+
'react-dev-utils',
311+
'react-scripts',
312+
]),
313+
// @remove-on-eject-end
314+
// If an error happens in a package, it's possible to be
315+
// because it was compiled. Thus, we don't want the browser
316+
// debugger to show the original code. Instead, the code
317+
// being evaluated would be much more helpful.
318+
sourceMaps: false,
319+
},
320+
},
321+
],
308322
},
309323
// "postcss" loader applies autoprefixer to our CSS.
310324
// "css" loader resolves paths in CSS and adds assets as dependencies.

packages/react-scripts/config/webpack.config.prod.js

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -351,34 +351,41 @@ module.exports = {
351351
{
352352
test: /\.(js|mjs)$/,
353353
exclude: /@babel(?:\/|\\{1,2})runtime/,
354-
loader: require.resolve('babel-loader'),
355-
options: {
356-
babelrc: false,
357-
configFile: false,
358-
compact: false,
359-
presets: [
360-
[
361-
require.resolve('babel-preset-react-app/dependencies'),
362-
{ helpers: true },
363-
],
364-
],
365-
cacheDirectory: true,
366-
// Save disk space when time isn't as important
367-
cacheCompression: true,
368-
// @remove-on-eject-begin
369-
cacheIdentifier: getCacheIdentifier('production', [
370-
'babel-plugin-named-asset-import',
371-
'babel-preset-react-app',
372-
'react-dev-utils',
373-
'react-scripts',
374-
]),
375-
// @remove-on-eject-end
376-
// If an error happens in a package, it's possible to be
377-
// because it was compiled. Thus, we don't want the browser
378-
// debugger to show the original code. Instead, the code
379-
// being evaluated would be much more helpful.
380-
sourceMaps: false,
381-
},
354+
use: [
355+
{
356+
loader: require.resolve('webpack-wci18n'),
357+
},
358+
{
359+
loader: require.resolve('babel-loader'),
360+
options: {
361+
babelrc: false,
362+
configFile: false,
363+
compact: false,
364+
presets: [
365+
[
366+
require.resolve('babel-preset-react-app/dependencies'),
367+
{ helpers: true },
368+
],
369+
],
370+
cacheDirectory: true,
371+
// Save disk space when time isn't as important
372+
cacheCompression: true,
373+
// @remove-on-eject-begin
374+
cacheIdentifier: getCacheIdentifier('production', [
375+
'babel-plugin-named-asset-import',
376+
'babel-preset-react-app',
377+
'react-dev-utils',
378+
'react-scripts',
379+
]),
380+
// @remove-on-eject-end
381+
// If an error happens in a package, it's possible to be
382+
// because it was compiled. Thus, we don't want the browser
383+
// debugger to show the original code. Instead, the code
384+
// being evaluated would be much more helpful.
385+
sourceMaps: false,
386+
},
387+
},
388+
],
382389
},
383390
// "postcss" loader applies autoprefixer to our CSS.
384391
// "css" loader resolves paths in CSS and adds assets as dependencies.

packages/react-scripts/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"babel-eslint": "9.0.0",
3232
"babel-jest": "23.6.0",
3333
"babel-loader": "8.0.4",
34+
"babel-plugin-bundled-import-meta": "^0.2.0",
3435
"babel-plugin-named-asset-import": "^0.2.2",
3536
"babel-preset-react-app": "^6.0.0",
3637
"bfj": "6.1.1",
@@ -59,6 +60,7 @@
5960
"mini-css-extract-plugin": "0.4.3",
6061
"optimize-css-assets-webpack-plugin": "5.0.1",
6162
"pnp-webpack-plugin": "1.1.0",
63+
"polymer-webpack-loader": "^2.0.3",
6264
"postcss-flexbugs-fixes": "4.1.0",
6365
"postcss-loader": "3.0.0",
6466
"postcss-preset-env": "6.0.6",
@@ -73,6 +75,7 @@
7375
"webpack": "4.19.1",
7476
"webpack-dev-server": "3.1.9",
7577
"webpack-manifest-plugin": "2.0.4",
78+
"webpack-wci18n": "github:fs-webdev/webpack-wci18n#modules",
7679
"workbox-webpack-plugin": "3.6.3"
7780
},
7881
"devDependencies": {

0 commit comments

Comments
 (0)