It depends on your module. For Webpack 2you can do something like this:
module.exports = {
...
resolve: {
modules: [
'node_modules',
path.resolve(__dirname + '/src')
],
alias: {
src: path.resolve(__dirname + '/src')
}
},
...
}
same for Webpack 1:
module.exports = {
...
resolve: {
root: [
path.resolve(__dirname + '/src')
],
alias: {
src: path.resolve(__dirname + '/src')
}
},
...
}
What you can use srcas a native path as follows:
import approxPerDay from 'src/utils/approxPerDay.js'
import otherstuff from '../components/otherstuff'
source
share