Comments (13)
ah it seems it's actually following the symlinks:
/Users/bartvandeneijnden/opengeo/git/sdk/js/components/Geocoding.jsx
../../sdk/js/components/Geocoding.jsx
from babel-plugin-react-intl.
Is there a way to protect the path so it never gets out of the messagesDir?
from babel-plugin-react-intl.
I don't understand the problem. What are the values for: the dir you're running Babel in, the configured messagesDir
, the dir where the .js
file is outputted, and the dir where the .json
files are outputted?
from babel-plugin-react-intl.
Run babel from: /Users/bartvandeneijnden/opengeo/git/sdk-apps/tabbed/
messagesDir: /Users/bartvandeneijnden/opengeo/git/sdk-apps/tabbed/build/messages/
dir where .js is outputted: /Users/bartvandeneijnden/opengeo/git/sdk-apps/tabbed/build/
dir where json files are outputted: /Users/bartvandeneijnden/opengeo/git/sdk-apps/tabbed/sdk/js/
from babel-plugin-react-intl.
Sorry I also meant to ask the source path to a JS file. Is it not under sdk-apps/tabbed/
?
What I'm thinking is that the problem is happening here: https://github.com/yahoo/babel-plugin-react-intl/blob/master/src/index.js#L157-L161
If you can step through those lines while running Babel that might show where the issue is. I haven't seen this happen before so I'm trying to figure out what's different with the inputs to this code that are resulting in the unexpected output.
from babel-plugin-react-intl.
Some of the source files are under the root dir of the app (sdk-apps/tabbed/
), others are in sdk-apps/tabbed/node_modules/boundless-sdk/js/components/
(those are the ones causing the issue. I've stepped through that code block before but will do it again.
from babel-plugin-react-intl.
I've never tried to compile code in node_modules
with Babel and this plugin, so it's likely something with that which is different. Are you using Webpack or something to run Babel on dependencies?
from babel-plugin-react-intl.
Here is the output from my logging:
filename: /Users/bartvandeneijnden/opengeo/git/sdk-apps/tabbed/app.jsx
p.relative(process.cwd(), filename): app.jsx
p.dirname(p.relative(process.cwd(), filename)): .
filename: /Users/bartvandeneijnden/opengeo/git/sdk/js/components/Geocoding.jsx
p.relative(process.cwd(), filename): ../../sdk/js/components/Geocoding.jsx
p.dirname(p.relative(process.cwd(), filename)): ../../sdk/js/components
filename: /Users/bartvandeneijnden/opengeo/git/sdk/js/components/FeatureTable.jsx
p.relative(process.cwd(), filename): ../../sdk/js/components/FeatureTable.jsx
p.dirname(p.relative(process.cwd(), filename)): ../../sdk/js/components
filename: /Users/bartvandeneijnden/opengeo/git/sdk/js/components/GeocodingResults.jsx
p.relative(process.cwd(), filename): ../../sdk/js/components/GeocodingResults.jsx
p.dirname(p.relative(process.cwd(), filename)): ../../sdk/js/components
filename: /Users/bartvandeneijnden/opengeo/git/sdk/js/components/QueryBuilder.jsx
p.relative(process.cwd(), filename): ../../sdk/js/components/QueryBuilder.jsx
p.dirname(p.relative(process.cwd(), filename)): ../../sdk/js/components
filename: /Users/bartvandeneijnden/opengeo/git/sdk/js/components/Select.jsx
p.relative(process.cwd(), filename): ../../sdk/js/components/Select.jsx
p.dirname(p.relative(process.cwd(), filename)): ../../sdk/js/components
filename: /Users/bartvandeneijnden/opengeo/git/sdk/js/components/Measure.jsx
p.relative(process.cwd(), filename): ../../sdk/js/components/Measure.jsx
p.dirname(p.relative(process.cwd(), filename)): ../../sdk/js/components
filename: /Users/bartvandeneijnden/opengeo/git/sdk/js/components/Chart.jsx
p.relative(process.cwd(), filename): ../../sdk/js/components/Chart.jsx
p.dirname(p.relative(process.cwd(), filename)): ../../sdk/js/components
filename: /Users/bartvandeneijnden/opengeo/git/sdk/js/components/Geolocation.jsx
p.relative(process.cwd(), filename): ../../sdk/js/components/Geolocation.jsx
p.dirname(p.relative(process.cwd(), filename)): ../../sdk/js/components
filename: /Users/bartvandeneijnden/opengeo/git/sdk/js/components/ImageExport.jsx
p.relative(process.cwd(), filename): ../../sdk/js/components/ImageExport.jsx
p.dirname(p.relative(process.cwd(), filename)): ../../sdk/js/components
filename: /Users/bartvandeneijnden/opengeo/git/sdk/js/components/QGISLegend.jsx
p.relative(process.cwd(), filename): ../../sdk/js/components/QGISLegend.jsx
p.dirname(p.relative(process.cwd(), filename)): ../../sdk/js/components
filename: /Users/bartvandeneijnden/opengeo/git/sdk/js/components/QGISPrint.jsx
p.relative(process.cwd(), filename): ../../sdk/js/components/QGISPrint.jsx
p.dirname(p.relative(process.cwd(), filename)): ../../sdk/js/components
filename: /Users/bartvandeneijnden/opengeo/git/sdk/js/components/AddLayer.jsx
p.relative(process.cwd(), filename): ../../sdk/js/components/AddLayer.jsx
p.dirname(p.relative(process.cwd(), filename)): ../../sdk/js/components
filename: /Users/bartvandeneijnden/opengeo/git/sdk/js/components/HomeButton.jsx
p.relative(process.cwd(), filename): ../../sdk/js/components/HomeButton.jsx
p.dirname(p.relative(process.cwd(), filename)): ../../sdk/js/components
filename: /Users/bartvandeneijnden/opengeo/git/sdk/js/components/LayerListItem.jsx
p.relative(process.cwd(), filename): ../../sdk/js/components/LayerListItem.jsx
p.dirname(p.relative(process.cwd(), filename)): ../../sdk/js/components
from babel-plugin-react-intl.
I'm using browserify with this transform:
"browserify": {
"transform": [
"cssify",
"babelify"
]
}
and this is my .babel.rc
:
{
"plugins": ["react-intl"],
"extra": {
"react-intl": {
"messagesDir": "./build/messages/",
"enforceDescriptions": true
}
}
}
from babel-plugin-react-intl.
This is a directory listing of the app's node modules:
Barts-MacBook-Air:tabbed bartvandeneijnden$ ls -l node_modules/
total 24
drwxr-xr-x 10 bartvandeneijnden staff 340 Dec 4 09:33 babel-plugin-react-intl
drwxr-xr-x 9 bartvandeneijnden staff 306 Dec 3 14:56 babelify
lrwxr-xr-x 1 bartvandeneijnden staff 71 Dec 3 15:05 boundless-sdk -> ../../../../../.nvm/versions/node/v4.2.2/lib/node_modules/boundless-sdk
drwxr-xr-x 13 bartvandeneijnden staff 442 Dec 3 14:57 browserify
drwxr-xr-x 9 bartvandeneijnden staff 306 Dec 3 14:56 cssify
drwxr-xr-x 10 bartvandeneijnden staff 340 Dec 3 14:56 envify
drwxr-xr-x 10 bartvandeneijnden staff 340 Dec 3 14:56 minifyify
lrwxr-xr-x 1 bartvandeneijnden staff 68 Dec 3 16:34 openlayers -> ../../../../../.nvm/versions/node/v4.2.2/lib/node_modules/openlayers
drwxr-xr-x 7 bartvandeneijnden staff 238 Dec 3 14:56 pui-react-buttons
drwxr-xr-x 8 bartvandeneijnden staff 272 Dec 3 14:56 pui-react-tabs
lrwxr-xr-x 1 bartvandeneijnden staff 63 Dec 3 15:05 react -> ../../../../../.nvm/versions/node/v4.2.2/lib/node_modules/react
drwxr-xr-x 9 bartvandeneijnden staff 306 Dec 3 14:56 react-dom
drwxr-xr-x 10 bartvandeneijnden staff 340 Dec 3 14:57 react-intl
drwxr-xr-x 6 bartvandeneijnden staff 204 Dec 4 09:05 sdk-debug-server
drwxr-xr-x 9 bartvandeneijnden staff 306 Dec 3 14:56 through
drwxr-xr-x 12 bartvandeneijnden staff 408 Dec 3 14:56 watchify
The symbolic links are because of the usage of npm link
When I don't use a link, all is fine. However, I need to use a link so I can edit the boundless-sdk
node module from the app during development.
from babel-plugin-react-intl.
If you can edit the plugin code locally to get it to work within your setup, feel free to send a PR. When I get a chance I'll try to setup a simple project to reproduce that uses symlinks to see if I can reproduce.
from babel-plugin-react-intl.
This should now be fixed with the changes from #32
from babel-plugin-react-intl.
thanks!
from babel-plugin-react-intl.
Related Issues (20)
- react-native HOT 1
- Not working with babel-loader 8.x HOT 4
- Generate Message ID HOT 1
- The "path" argument must be of type string (v2.4.0) HOT 3
- Allow other component names than the build-in ones HOT 4
- plugin does not seem to do anything HOT 1
- Only defineMessages works. FormattedMessage is ignored. HOT 9
- file.log.warn causes TypeError: Cannot read property 'warn' of undefined HOT 3
- Am I supposed to use this plugin to obtain translation files? HOT 3
- Babel 7 support HOT 3
- Error: Cannot find module 'upath' HOT 3
- Cannot find module babel-plugin-react-intl when extracting messages HOT 1
- id containing multiple period would not work.
- [Babel 7] TypeError: Path must be a string. Received undefined HOT 7
- Any option to remove `defaultMessage` field in production? HOT 1
- cache is not working properly HOT 3
- Extracting message by formatMessage directly but defineMessages HOT 1
- Support spread syntax (or expression) for defineMessages
- Plugin does nothing, how to debug? (using with Gatsby) HOT 2
- [React Intl] `undefined()` must be called with an object expression with values that are React Intl Message Descriptors, also defined as object expressions. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from babel-plugin-react-intl.