trayio / babel-plugin-webpack-alias

babel 6 plugin which allows to use webpack resolve options
MIT License
150 stars 32 forks source link

don't work #48

Closed justinjzs closed 7 years ago

justinjzs commented 7 years ago

webpack.config.js:

alias: {
    'react-df': path.join(__dirname, 'src/react-df.js'),
}

.babelrc:

    "env": {
        "test": {
            "plugins": [
                "babel-plugin-webpack-alias", { "config": "./webpack.config.js" }
            ]
        }

xxx.test.js:

import df from 'react-df'
......

when i run with cmd: "set NODE_ENV=test && mocha --compilers js:babel-register test/*/.test.js" the error message is "Cannot find module 'react-df'"

new: i try to change .babelrc to

"plugins": [
    "webpack-aliases"
]

it work! ,however i put it in the env as

    "env": {
        "test": {
            "plugins": [
                "webpack-aliases"
            ]
        }
    },

it don't work, i add a log in test.js, the process.env.NODE_ENV is test. why it don't work?

justinjzs commented 7 years ago

i think it's not a problem of that repo,so i close it